yarn icon indicating copy to clipboard operation
yarn copied to clipboard

Command 'yarn' not found | Can't install Yarn on debian

Open ITCMD opened this issue 4 years ago • 4 comments

After installing yarn properly on an unchanged debian system (lubuntu 19.04) it simply will not allow me to run yarn.

Here is what happens when I try and install:

My Install Process

  1. Install nodejs
ftp@ftp-optiplex:~$ sudo apt install nodejs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
nodejs is already the newest version (12.18.2~dfsg-1ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
ftp@ftp-optiplex:~$
  1. Install npm
ftp@ftp-optiplex:~$ sudo apt install npm
Reading package lists... Done
Building dependency tree       
Reading state information... Done
npm is already the newest version (6.14.8+ds-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
ftp@ftp-optiplex:~$
  1. Install yarn
ftp@ftp-optiplex:~$ sudo npm install -g yarn

> [email protected] preinstall /usr/local/lib/node_modules/yarn
> :; (node ./preinstall.js > /dev/null 2>&1 || true)


ftp@ftp-optiplex:~$ 

Test install

ftp@ftp-optiplex:~$ yarn -v
Command 'yarn' not found, but can be installed with:
sudo apt install cmdtest
ftp@ftp-optiplex:~$

Additional info and variables

ftp@ftp-optiplex:~$ npm bin -g
/usr/local/bin

npm's install bin is /usr/local/bin

/usr/local/bin is included in $PATH: /usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

ftp@ftp-optiplex:~$ ls /usr/local/bin/
ftp@ftp-optiplex:~$ 

The /usr/local/bin folder is empty

ITCMD avatar Feb 08 '21 14:02 ITCMD

I'm having this same issue, doing npm install --global yarn on Ubuntu now results in

INFO[0159] cmd: /bin/sh                                 
INFO[0159] args: [-c npm install --global npm yarn]     
INFO[0159] util.Lookup returned: &{Uid:0 Gid:0 Username:root Name:root HomeDir:/root} 
INFO[0159] performing slow lookup of group ids for root 
INFO[0159] Running: [/bin/sh -c npm install --global npm yarn] 
> [email protected] preinstall /usr/lib/node_modules/yarn
> :; (node ./preinstall.js > /dev/null 2>&1 || true)

But just last week, it worked fine. 

anders-ni avatar Feb 15 '21 19:02 anders-ni

Exact same issue here.

$ sudo npm install --global yarn

> [email protected] preinstall /usr/local/lib/node_modules/yarn
> :; (node ./preinstall.js > /dev/null 2>&1 || true)

Version 1.22.6 is the most recent version that seems to work for me.

MQDuck avatar Feb 16 '21 00:02 MQDuck

Possibly related to a NodeJs change from 14.15.4 -> 14.15.5?

I ended up just changing my yarn install to do this, and it was enough to get me unstuck

RUN curl -sL 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 && apt-get install yarn

anders-ni avatar Feb 16 '21 13:02 anders-ni

Possibly related to a NodeJs change from 14.15.4 -> 14.15.5?

I ended up just changing my yarn install to do this, and it was enough to get me unstuck

RUN curl -sL 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 && apt-get install yarn

Thanks, this worked for me

majjikishore007 avatar Sep 13 '22 05:09 majjikishore007