Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: [Errno 2] No such file or directory: 'add' #3708

Closed
curiousPup opened this issue Jun 23, 2017 · 33 comments
Closed

ERROR: [Errno 2] No such file or directory: 'add' #3708

curiousPup opened this issue Jun 23, 2017 · 33 comments

Comments

@curiousPup
Copy link

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

this is the error i get when I try running yarn add
my current yarn version is 0.10.

@bestander
Copy link
Member

Thanks for reporting but there is not enough information to act on this.
Please follow the draft and add more data so that we could reproduce.
Current Yarn version is 0.26

@curiousPup
Copy link
Author

curiousPup commented Jun 26, 2017

So whenever I am trying to add a package with yarn, lets say
yarn add stickybits

it throws an error which is,
ERROR: [Errno 2] No such file or directory: 'add'

And it is behaving the same way for 'install' and 'init' as well

@jcrowe206
Copy link

@SDhalor I had this issue as well. Running it with sudo fixed it for me

@curiousPup
Copy link
Author

Thank you but it did not work for me

@rameshvishnoi90904
Copy link

i am also facing same issue

@rickovermars
Copy link

I was facing the same problem. I am using Ubuntu (17.04) and used sudo apt install yarn to install yarn. This however, did not install yarn, but a package named cmdtest.

You need to follow the installation instructions on the website https://yarnpkg.com/lang/en/docs/install/ and add a repo first. This will then include the correct yarn, but there will still be a conflict when running apt install yarn, since cmdtest is still there. To correct this run the following command:
sudo apt-get -o Dpkg::Options::="--force-overwrite" install yarn

Then run sudo apt install yarn and yarn init should work properly.

@JonathanFerreira
Copy link

Thanks @rickovermars ! Worked for me ! 😄

@dlazov
Copy link

dlazov commented Sep 12, 2017

I am attempting to install yarn on Debian 9 (stretch). I followed the instructions on and it seemed to install correctly (I also setup the path as well), I could run yarn --version and it showed me 0.27. However I could not run yarn init or yarn add (to an existing project) gave me that:

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

I then followed the steps provided by @rickovermars but that also results in the same output/error message.

Any thoughts on why yarn add fails on Debian 9?

Also, I tried installing via one of the alternatives: npm install --global yarn and that also results in the same error output.

@dlazov
Copy link

dlazov commented Sep 13, 2017

Well this is interesting, I left my Debian up and running all night long and this morning from within Visual Studio Code and its terminal window I ran:

dlazov@zovs-debian:~/projects/checkout-app$ yarn add @webcomponents/webcomponentsjs
yarn add v1.0.1
info No lockfile found.
[1/4] Resolving packages...
warning angular-cli@1.0.0-beta.28.3: angular-cli has been renamed to @angular/cli. Please update your dependencies.
error Received malformed response from registry for undefined. The registry may be down.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
warning minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue

So what I discovered (and shame on me) is that I had to restart my terminal. That was slightly disturbing and embarrassing.

So all is well in linux...

@BiBzz
Copy link

BiBzz commented Sep 28, 2017

I had to run sudo apt remove cmdtest before I could install correctly yarn with sudo apt install yarn

@yami12376
Copy link

yami12376 commented Nov 5, 2017

On Ubuntu 17.10 commends to make it work:

sudo apt remove cmdtest
sudo apt remove yarn

then following https://yarnpkg.com/lang/en/docs/install/

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

and using rickovermars answer

sudo apt-get -o Dpkg::Options::="--force-overwrite" install yarn

Test - version should be more than 0.2X (in my case)

yarn -version
1.3.2

@tomtobac
Copy link

I did not remove the yarn/cmdtest package before to use the command to override the installation of yarn:

 sudo apt-get -o Dpkg::Options::="--force-overwrite" install yarn

Now when I try to install it, I get:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'cmdtest' instead of 'yarn'
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.

Any idea to how to revert/remove the overwrite command?

@awakeelectronik
Copy link

how do it http://descargarmusicatorrent.top/167-debian/399-problems-install-yarn-on-debian-9-stretch

@pradt
Copy link

pradt commented Jan 10, 2018

Everything you guys had said, I finally followed @yami12376 instructions but I was still getting cmdtest installing. I had to sudo apt update before running sudo apt-get -o Dpkg::Options::="--force-overwrite" install yarn

Now everything works.

@dmz9
Copy link

dmz9 commented Mar 12, 2018

ubuntu 17.10
caused by wrong yarn installation (cmdtest instead of yarn)
solved by this
sudo apt-get remove cmdinstall;sudo apt update;sudo apt-get install yarn
ref to #3189

@Rim-777
Copy link

Rim-777 commented Mar 13, 2018

@dmz9 It works for linux mint 18.3 as well. Thanx!

@arasemami
Copy link

its so simple just follow me step to step 👍

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
sudo apt-get install --no-install-recommends yarn

yarn --version
example: 1.7.0

and later cd go to dir in your app **important everybody forgets it ;) **

sudo yarn install

@phanhoc
Copy link

phanhoc commented Sep 5, 2018

Install Yarn for Ubuntu 18.04 LTS reference to link: https://qiita.com/shaching/items/a1e8bf937f1ad049b8cd
It works for me!
Step 1: Configure the repository
$ 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
Step 2: Install Yarn
$ sudo apt-get update && sudo apt-get install --no-install-recommends yarn
Step 3: Verify
$ yarn -v
show 1.9.4

@ousid
Copy link

ousid commented Oct 13, 2018

if you have a problem while installing yarn you can simply remove the yarn like [cmdtest] by
sudo apt-get remove cmdtest and try to install 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

@cwhsu1984
Copy link

Still seeing this on ubuntu 18.04, I hope this will be fixed soon. It's somehow confusing at the first sight.

@felexkemboi
Copy link

running with sudo has worked with me perfectly

@kid1412621
Copy link

Install Yarn for Ubuntu 18.04 LTS reference to link: https://qiita.com/shaching/items/a1e8bf937f1ad049b8cd
It works for me!
Step 1: Configure the repository
$ 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
Step 2: Install Yarn
$ sudo apt-get update && sudo apt-get install --no-install-recommends yarn
Step 3: Verify
$ yarn -v
show 1.9.4

damn useful !!! ubuntu 18.10 . cannot understand why installing yarn is so painful.

@bethwelt
Copy link

bethwelt commented Apr 13, 2019

this solved my issue
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 remove cmdtest
sudo apt install yarn
I had avoided doing sudo apt update and also had a problem with the sources.list.d

@hellocaio
Copy link

@bethwelt , thanks mate, your solution worked for me!

@austinwk
Copy link

My issue was copying and pasting both commands as listed in the yarn install guide at one time:

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

In doing so, the second was not executed. This was verified after inspecting /etc/apt/sources.list. As a result, the yarn package was never made available to apt. By individually running each command, the issue was resolved and yarn appeared in the list of available packages.

If you run sudo apt search yarn and do not see it listed as an available package, confirm that the repo was added to /etc/apt/sources.list.

@tecknovice
Copy link

Install Yarn for Ubuntu 18.04 LTS reference to link: https://qiita.com/shaching/items/a1e8bf937f1ad049b8cd
It works for me!
Step 1: Configure the repository
$ 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
Step 2: Install Yarn
$ sudo apt-get update && sudo apt-get install --no-install-recommends yarn
Step 3: Verify
$ yarn -v
show 1.9.4

thank

@mpw-wwu
Copy link

mpw-wwu commented Nov 5, 2019

Another quick workaround is to install yarn via npm

npm -g i yarn

@spect1
Copy link

spect1 commented Feb 1, 2020

if the error persists after trying to install yarn, close terminal and open a new terminal
yarn --version

@rafwell
Copy link

rafwell commented Feb 17, 2020

First, remove cmdtest, so run npm install yarn -g. Reload the terminal.

@AndrianBalanescu
Copy link

ubuntu 17.10
caused by wrong yarn installation (cmdtest instead of yarn)
solved by this
sudo apt-get remove cmdinstall;sudo apt update;sudo apt-get install yarn
ref to #3189

It worked awesome

@medaharrat
Copy link

I am using the latest stable release of Ubuntu OS, I had the same issue, but then, I followed the installation guide here, and everything worked perfectly.

@Devashishsingh98
Copy link

Do as arasemami he said , everything will work fine.

@archanaaniyan1341
Copy link

thankyou tthis worked for me

@yarnpkg yarnpkg locked as resolved and limited conversation to collaborators Jun 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests