Yarn install command error No such file or directory: 'install'
Solution 1
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
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
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
The following steps worked on Pop!_OS 20.10 & ubuntu 20.04
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
yarn install
Solution 5
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.
Related videos on Youtube
Ricky ponting
Updated on February 19, 2022Comments
-
Ricky ponting about 2 years
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'
-
chaenu over 6 yearsPlease run
yarn install --verbose
and add the extended information. Are you sure you're running yarn in the right folder (which contains a package.json)? -
Jérôme Pouiller over 2 years
yarn
is not the package you are looking for. You wantyarnpkg
. See stackoverflow.com/a/70184799/301717
-
-
Cédric Françoys about 6 yearsI had the same situation : sudo apt remove cmdtest is the key !
-
Mike Lyons almost 6 yearsHad this same issue on Debian WSL on windows 10 and this solution worked for me
-
Saif Al Falah over 5 yearsI was having this same problem on Ubuntu WSL on Windows 10. This solution worked for me too.
-
James L. over 5 yearsI just needed to run
sudo apt-get install yarn
-
Kwhitejr over 5 yearsAny reason why this solution would not work with docker? I have a base image from Ubuntu 18.04. Running these commands
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ apt-get update \ && yes Y | apt-get install --no-install-recommends yarn RUN yarn --version
results in yarn version 0.32.0, which fails on basic things likeyarn init
-
oma over 5 yearsworked for me. I needed sudo on npm, that's the only difference. Ubuntu 18.04
-
mirageglobe over 5 yearsOn docker, came across this way. Try : RUN curl -o- -L yarnpkg.com/install.sh | bash
-
Christopher Kikoti over 5 yearsThis was very helpful
-
CPBL over 5 yearsfixed problem for me on 18.10
-
Crampus about 5 yearsRunning it with
sudo
fixed it for me -
Gebus about 5 yearsThank you, it worked for me. The user has to belong to sudo group if you want to get the rights of your user on the folders : sudo usermod -aG sudo myusername
-
ashishdhiman2007 about 5 yearsDo remember to re-open terminal for changes to take effect.
-
Darius.V about 5 yearson xubuntu 18 I get error: Err:19 ppa.launchpad.net/gnome-terminator/ppa/ubuntu bionic Release 404 Not Found [IP: 91.189.95.83 80]
-
programmingmusic almost 5 yearsWorked for me Ubuntu 18.04
-
pulzarraider over 4 yearsThe reason this is happenning is, that when you installed yarn you forgot to run
sudo apt-get update
after updating the apt sources and before calling the sudo apt install yarn. -
Markus Zeller over 4 yearsPerfect solution for Windows10 WSL.
-
Michael Durrant over 4 yearsWorked for me on 19.04 Dec 2019
-
Albert Rannetsperger about 4 yearsThis fixed my issue. Thank you.
-
mahesh kajale about 4 yearsI have installed yarn using npm and which is very straightforward and easy on ubuntu. sudo npm install --global yarn
-
RichS almost 4 yearsOn 05/17/2020, this solution worked better for me. On Debian 9.9. The accepted answer still resulted in the OP's original problem. (but I was able to npm i without the sudo)
-
Caique Andrade almost 4 yearsIt helps me =D a
-
duyetpt almost 4 yearsThanks you, it worked and
sudo apt remove -y cmdtest
for auto confirm -
brownmagik352 almost 4 yearsfixed it for me on cloud9 hosted Ubuntu 18.04.4 LTS
-
jurgenizer almost 4 yearsThis worked for me on elementary OS 5.1.7 Hera (Built on Ubuntu 18.04.4 LTS).
-
Guss over 3 yearsreplace
echo...tee...apt-get update
withapt-add-repository -y "deb ... main"
. -
Clemen Canaria over 3 yearsWorks for me too. Thank you
-
Leandro Perini over 3 yearsshould be a comment not an answer
-
dxvargas over 3 yearsThis information is mostly available in classic.yarnpkg.com/en/docs/install/#debian-stable
-
Kyle Bridenstine over 3 yearsI had to also run this command at the end for it to work for me stackoverflow.com/a/57748163/3299397
-
Jakub Ujvvary over 3 yearsfixed problem on ubuntu 20.04
-
Mattias Martens over 3 yearsWhen I run
sudo npm install -g yarn
, I just get this mystifying output: > [email protected] preinstall /usr/local/lib/node_modules/yarn > :; (node ./preinstall.js > /dev/null 2>&1 || true) And no further instruction. I'm running Ubuntu 20.04.1 on WSL. -
James Shapiro over 3 yearsFixed it for me on Ubuntu 18.04 running on an Azure VM
-
kunal pal over 3 yearsWork like charm.
-
Mr Kashyap over 3 yearsInstall yarn using below commands in Ubuntu 20 machines.
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
-
Saplu over 3 yearsTried a million solutions before and this one finally worked. Love you!
-
Nicky Kouffeld over 3 yearsSaved my day! Confirmed on 20.04
-
Michael Scheper about 3 yearsThanks for this explanation. I prefer not to blind commands I see on StackOverflow, especially when they're used with
sudo
! I think this should be the selected answer. -
Ryan almost 3 years+1, and as stackoverflow.com/a/65578819/470749 mentioned, I needed to exit and re-open my terminal before yarn would work.
-
Guss almost 3 years@Ryan that is interesting - I believe you need to restart your shell if you just installed
npm
: the installation modifies the shell startup sequence to add the npm "global" installation directory to the shellPATH
, otherwise the shell doesn't see theyarn
command installed there. You can check that - if just runningyarn
doesn't work but~/.npm-packages/bin/yarn
does, then you need to restart the shell to get thePATH
updated. -
JayKandari over 2 yearsYes this fixed for me as well
-
Akshay Shah over 2 yearsWorked on Ubuntu 18.04 too!
-
Ravi over 2 yearsThanks for the solution, worked for Ubuntu 20.04.2 LTS as well.
-
Hadisur Rahman over 2 yearsPerfect, worked for me too.
-
Hadisur Rahman over 2 yearsworked for me, thanks
-
Gorkem about 2 yearsworked for ubuntu 20.04
-
nsandersen about 2 yearsHad no effect, same error message afterwards.
-
Hadisur Rahman about 2 yearsWorked for ubuntu 22.04 LTS
-
Leo almost 2 yearsWorked on WSL Ubuntu 20.04
-
user598527 almost 2 years
alias
'ng not possible when theyarn
binary exists:ln: failed to create symbolic link '/usr/local/bin/yarn': File exists
-
user598527 almost 2 yearsthe error changed to
bash: /usr/bin/yarn: No such file or directory
in Ubuntu Docker — see stackoverflow.com/a/70184799/6404709 -
Guss almost 2 years@user598527 : the
/usr/local/bin/yarn
should only exist if you already have yarn installed throughnpm -g
or some external process. If that is the case - then you don't need to installyarnpkg
. Please note that recent versions of the official Node docker container already include Yarn so you don't need to install it. -
Guss almost 2 years@user598527 as noted on that other answer you linked, if you are using the official Node container, you don't need to worry about any of that and Yarn is pre-installed. Otherwise this error message doesn't make any sense - either you triggered a symbolic link to
/usr/bin/yarn
or you specifically typed it - otherwise the expected error isbash: yarn: command not found
. Yarn from NPM is installed in/usr/local/bin
, so none of that make sense. If you are still having issues, please provide more details. -
Monero Jeanniton almost 2 yearsThank you! Your solution has worked for me