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
Using the --no-save will tell npm not to remove the package from your package. json , npm-shrinkwrap. json , or package-lock. json files.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With