yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.44k stars 2.72k forks source link

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

Open ITCMD opened 3 years ago

ITCMD commented 3 years ago

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:~$
  2. Install yarn

    
    ftp@ftp-optiplex:~$ sudo npm install -g yarn

yarn@1.22.10 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*
anders-ni commented 3 years ago

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] 
> yarn@1.22.10 preinstall /usr/lib/node_modules/yarn
> :; (node ./preinstall.js > /dev/null 2>&1 || true)

But just last week, it worked fine. 
MQDuck commented 3 years ago

Exact same issue here.

$ sudo npm install --global yarn

> yarn@1.22.10 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.

anders-ni commented 3 years ago

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
majjikishore007 commented 2 years ago

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