Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

yarn dependency, nodejs, is removed during installation of yarn, and vice versa?

Trying to install a package with yarn, but I get and error saying I need nodejs, but installing nodejs removes yarn. Likewise, when I install yarn, nodejs is removed. What am I missing?

$ yarn install some-package
Yarn requires Node.js 4.0 or higher to be installed.

$ curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
...
...
$ sudo apt-get install -y nodejs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gyp libc-ares-dev libjs-node-uuid libv8-3.14-dev
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  yarn
The following NEW packages will be installed:
  nodejs
...

$ sudo apt-get install yarn
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gyp libc-ares-dev libjs-node-uuid libv8-3.14-dev
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  nodejs
The following NEW packages will be installed:
  yarn
...
like image 649
soupmagnet Avatar asked Apr 18 '17 14:04

soupmagnet


People also ask

How do I reinstall dependencies on yarn?

To install dependencies, you have to run yarn install in the root of your directory to install all the dependencies for a project. The dependencies will be retrieved from the package. json file you pushed to version control, and will be stored in the yarn. lock file.

Is node js required for yarn?

Before installing and using the Yarn package manager, you will need to have Node. js installed.

Is yarn better than npm 2022?

The major difference between NPM and Yarn comes in terms of security performance. While NPM installs packages sequentially, Yarn performs parallel installation resulting in better speed and performance. NPM has tried to fix vulnerabilities, but still, Yarn is considered more secure than NPM.

Can I install yarn without npm?

We can install modules required for a particular project in node. js without npm, the recommended node package manager using yarn.


1 Answers

I ran into this issue while attempting to install Yarn and NodeJS on WSL. Here are the steps I took to get it working:

apt-get remove node
apt-get remove yarn

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

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-get update && sudo apt-get install yarn
like image 181
andyjv Avatar answered Sep 18 '22 20:09

andyjv