Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does installing one npm package remove many others?

Tags:

I'm having difficulty installing a package using npm. The package installs successfully, however, it removes a whole bunch of other packages.

I'm not able to reproduce this on another machine. Here's the output of the package install:

[masterwok@crunchbox Caster]$  npm install react-native-google-cast --save
npm notice created a lockfile as package-lock.json. You should commit this file.
+ [email protected]
added 1 package and removed 638 packages in 7.967s
[masterwok@crunchbox Caster]$  

As you can see, it completely destroys my application dependencies. What could cause this? If I had to guess, I'd say some dependency is failing to be met which cascades down. I have no idea hah

like image 614
masterwok Avatar asked Jun 08 '17 02:06

masterwok


People also ask

How do I prevent npm install from removing packages?

Using the --no-save will tell npm not to remove the package from your package. json , npm-shrinkwrap. json , or package-lock. json files.

Does npm install multiple versions of same package?

With npm or yarn, you can install a package under a custom alias. This enables you to install multiple versions of a package in the same project.

Why does npm install have so many vulnerabilities?

It's probably because package management for even a medium-sized project is a constant battle, as new vulnerabilities are being discovered every day. What if you run npm audit fix ? Does that help you? because decencies are old and they are way behind than stable/latest version of that package.

What happens when you npm install a package?

When npm install is run with a specified package argument, it installs the package in the existing node_modules directory. You can optionally provide a specific version as well... When a version is not provided, npm automatically downloads the latest stable version.


1 Answers

I'm not entirely sure why npm is doing what it's doing, but from the look of the output, package-lock, I surmise that you're using npm5.

Try downgrading to npm 4.

like image 112
klvs Avatar answered Sep 24 '22 11:09

klvs