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

UbuntuNpmUbuntu 14.04YarnpkgSylius

Ubuntu Problem Overview


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

yarn install

I get the error: > ERROR: [Errno 2] No such file or directory: 'install'

Ubuntu Solutions


Solution 1 - Ubuntu

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.

Solution 2 - Ubuntu

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

Solution 3 - Ubuntu

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.

Solution 4 - Ubuntu

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

Solution 5 - Ubuntu

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.

Solution 6 - Ubuntu

> TL;DR
> lang-js > // 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

Solution 7 - Ubuntu

this worked for me

sudo yarn install

Solution 8 - Ubuntu

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

Solution 9 - Ubuntu

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!

Solution 10 - Ubuntu

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

Solution 11 - Ubuntu

There is a name conflict for the yarn package (which is currently an alias to cmdtest package). The package you are looking for is yarnpkg. So, try this command:

sudo apt-get remove cmdtest
sudo apt-get install yarnpkg

Unfortunately, with yarnpkg, command yarn is named yarnpkg. You probably want to make an alias:

sudo ln -s /usr/bin/yarnpkg /usr/local/bin/yarn

Solution 12 - Ubuntu

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!

Solution 13 - Ubuntu

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

Solution 14 - Ubuntu

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

Solution 15 - Ubuntu

sudo npm install -g yarnpkg
npm WARN deprecated yarnpkg@0.15.1: Please use the `yarn` package instead of `yarnpkg`

so this works for me

sudo npm install -g yarn

Solution 16 - Ubuntu

If your node version is above 16.10. You can simply run the following to use yarn commands.

corepack enable

If your node version is before 16.10. Run npm i -g corepack before running the above command.

Solution 17 - Ubuntu

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

Solution 18 - Ubuntu

I have installed yarn in different ways and when I run yarn in the console it notifies me that "bash: /usr/bin/yarn: File or directory does not exist". I go to the path /usr/bin and the binary I find is yarnpkg. I runyarnpkg in the console and it installs all the dependencies. Note: all the yarn commands work with yarnpkg. If you have any questions we will continue to see them in the forum execute yarnpkg build

execute yarnpkg and run yarn install

execute yarn install and launch error

Solution 19 - Ubuntu

If you are trying to deploy to AWS or any other cloud infrastructure follow the link below

Linuxize this will help solve yarn issue on AWS but still having build time issue thou.

Solution 20 - Ubuntu

Using Ubuntu 22.04 I had this problem from a fresh install of Ubuntu. The fix that worked for me:

sudo apt remove cmdtest
sudo apt-get remove yarn && sudo apt-get purge yarn
sudo apt update
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 install yarn
yarn --version # 1.22.19

(EDIT: I've tried this subsequently and it didn't initially work. But when I restarted my computer and tried again it did work. Figure that one out...)

Solution 21 - Ubuntu

Run:

source ~/.profile 

and try again

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRicky pontingView Question on Stackoverflow
Solution 1 - UbuntuzappeeView Answer on Stackoverflow
Solution 2 - UbuntuNetEmmanuelView Answer on Stackoverflow
Solution 3 - UbuntuVikas YadavView Answer on Stackoverflow
Solution 4 - UbuntuPraveenView Answer on Stackoverflow
Solution 5 - UbuntuGussView Answer on Stackoverflow
Solution 6 - UbuntuJunaidView Answer on Stackoverflow
Solution 7 - UbuntuUnkasView Answer on Stackoverflow
Solution 8 - Ubuntufr0xView Answer on Stackoverflow
Solution 9 - UbuntuWatchmakerView Answer on Stackoverflow
Solution 10 - UbuntuMr KashyapView Answer on Stackoverflow
Solution 11 - UbuntuJérôme PouillerView Answer on Stackoverflow
Solution 12 - UbuntujovialcoreView Answer on Stackoverflow
Solution 13 - UbuntuAdesoftView Answer on Stackoverflow
Solution 14 - UbuntuFullStackFoolView Answer on Stackoverflow
Solution 15 - UbuntuYanni ZhengView Answer on Stackoverflow
Solution 16 - UbuntuRahul SunilView Answer on Stackoverflow
Solution 17 - UbuntuR FischerView Answer on Stackoverflow
Solution 18 - UbuntuAndy LuisView Answer on Stackoverflow
Solution 19 - UbuntuCodedreamerView Answer on Stackoverflow
Solution 20 - UbuntuJimmyTheCodeView Answer on Stackoverflow
Solution 21 - UbuntuenobyteView Answer on Stackoverflow