[ubuntu] Yarn install command error No such file or directory: 'install'

I am installing sylius bundle and while install sylius I need to run yarn install So While i run command

yarn install

I get error:

ERROR: [Errno 2] No such file or directory: 'install'

This question is related to ubuntu ubuntu-14.04 sylius yarnpkg

The answer is


Note: This solution works well on Ubuntu 16.04, Ubuntu 17.04 and Ubuntu 18.04.

Try to remove the existing cmdtest and yarn (which is the module of legacy black box command line tool of *nix systems) :

sudo apt remove cmdtest
sudo apt remove yarn

Install it simple via npm

npm install -g yarn

OR

sudo npm install -g yarn

Now yarn is installed. Run your command.

yarn install sylius

I hope this will work. Cheers!

Edit:

Do remember to re-open the terminal for changes to take effect.


sudo npm install -g yarnpkg
npm WARN deprecated [email protected]: Please use the `yarn` package instead of `yarnpkg`

so this works for me

sudo npm install -g yarn

I had the same issue on Ubuntu 17.04.

This solution worked for me:

sudo apt remove cmdtest
sudo apt remove yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install yarn -y

then

yarn install

result:

yarn install v1.3.2
warning You are using Node "6.0.0" which is not supported and may encounter bugs or unexpected behaviour. Yarn supports the following server range: "^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0"
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...

info Lockfile not saved, no dependencies.
Done in 0.20s.

Hope that it will help you.


For Ubuntu 18.04.4 LTS I just followed the official instructions: https://classic.yarnpkg.com/en/docs/install#debian-stable

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

sudo apt update && sudo apt install yarn

No need to do:

sudo apt remove cmdtest

That is only necessary on Ubuntu 17.04.* I think.

I hope it helps!


Tried above steps, didn't work on Ubuntu 20. For Ubuntu 20, remove the cmdtest and yarn like suggested above. Install yarn with below commands:

curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -

echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

sudo apt update && sudo apt install yarn

My solution was

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -

echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

sudo apt-get update && sudo apt-get install yarn

I had the same issue on Ubuntu 18.04. This was what worked for me:

I removed cmdtest and yarn

sudo apt remove cmdtest

sudo apt remove yarn

Install yarn globally using npm

sudo npm install -g yarn

TL;DR

// Run these commands (Tested on Ubuntu 17.04 & above)
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn

Additional Notes: Check out this official documentation/guide for installing yarn on other Ubuntu versions & to take care of additional cmdtest errors. https://yarnpkg.com/lang/en/docs/install/#debian-stable

If you don't have curl installed you can install it using sudo apt install curl


this worked for me

sudo yarn install

I believe all relevant solutions have been provided but here is a subtle situatuion: know that if you don't close and open your terminal again you will not see the effect.

Close your terminal and open then type in your terminal

yarn --version

Cheers!


Run:

source ~/.profile 

and try again


With kudos to all the answers that correctly suggest removing the Ubuntu yarn package and installing Yarn through NPM, here is a detailed answer with explanation (and, be warned, opinions):

The reason for the No such file or directory error from yarn install is that you are not using the "correct" Yarn: the software you get when you install yarn using the Ubuntu software sources is the "yarn" scenario testing tool from the cmdtest blackbox testing suite. This is likely not what you meant as Yarn is also a popular development lifecycle tool for Javascript application (similar to Make, Maven and friends).

The Javascript Yarn tool is not available from Ubuntu software sources but can be installed by NPM (which is another development lifecycle tool that Yarn aims to replace - so that's awkward...).

To make Yarn available in Ubuntu, start by removing cmdtest and its tools:

$ sudo apt purge cmdtest

Then make sure NPM is installed:

$ sudo apt install npm

Then use NPM to install Yarn:

$ npm install -g yarn

Note: using npm install -g will install a Javascript package for your current user account, which should be fine for most purposes. If you want to install Yarn for all users, you can use sudo for the NPM command, but that is not recommended: NPM packages are rarely audited for security in the context of a multi-user operating system and installing some packages might even break when installing them as "root". NPM used to warn against running it with sudo and the main reason it is not doing so today is that it annoys people that use sandboxed "root-like" environments (such as Docker) for building and deploying Javascript applications for single-user servers.


Installing Yarn for Ubuntu 16.04 (not sure if this will be the same as 14.04 as it's slightly different than zappee's answer for 17.04)

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
apt-get update
apt-get install nodejs
apt-get install yarn

Then from wherever you installed your sylius project (/var/www/mysite)

yarn install
yarn run gulp

Just copy and paste this code one after on your terminal It worked perfectly well for me.

sudo apt remove cmdtest
sudo apt remove yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install yarn -y

Also had this issue (windows), the fix was a complete closure of all terminal instances, then retry.


The following steps worked on Pop!_OS 20.10 & ubuntu 20.04

  1. sudo apt remove cmdtest
  2. sudo apt remove yarn
  3. curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
  4. echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
  5. sudo apt-get update
  6. sudo apt-get install yarn -y
  7. yarn install

Examples related to ubuntu

grep's at sign caught as whitespace "E: Unable to locate package python-pip" on Ubuntu 18.04 How to Install pip for python 3.7 on Ubuntu 18? "Repository does not have a release file" error ping: google.com: Temporary failure in name resolution How to install JDK 11 under Ubuntu? How to upgrade Python version to 3.7? Issue in installing php7.2-mcrypt Install Qt on Ubuntu Failed to start mongod.service: Unit mongod.service not found

Examples related to ubuntu-14.04

Yarn install command error No such file or directory: 'install' How to remove docker completely from ubuntu 14.04 Cannot connect to the Docker daemon at unix:/var/run/docker.sock. Is the docker daemon running? Docker Error bind: address already in use no target device found android studio 2.1.1 How to use systemctl in Ubuntu 14.04 Android Studio: /dev/kvm device permission denied How to download a folder from github? Ubuntu: Using curl to download an image Compile c++14-code with g++

Examples related to sylius

Yarn install command error No such file or directory: 'install'

Examples related to yarnpkg

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined raised when starting react app Module not found: Error: Can't resolve 'core-js/es6' Yarn: How to upgrade yarn version using terminal? Yarn install command error No such file or directory: 'install' How to install package from github repo in Yarn How Do I Uninstall Yarn How to clear cache in Yarn?