Home > Mobile >  npm install WARNs
npm install WARNs

Time:06-29

I've tried updating npm after I did some WARNings, so I went

npm audit fix 

received way more WARNs. Now when i tried installing all dependencies with

npm i 

I got tons of WARN (see below). I honestly haven't got a clue what any of these mean, but did not have any before the npm fix.

enter image description here

CodePudding user response:

Looks like you're using deprecated packages. Try running

npm outdated

it will show you the current version, desired version, and latest version for each of your package. That won't actually do anything to your project, but it's a good first indication.

If you run

npm update

it will update each package according to what your package.json says. For instance if you see this in your package.json

"my-package": "~1.25.0"

it means that npm update will install version 1.25.0 or the latest patch version such as 1.25.4.

If you see

"my-package": "^1.25.0"

it means that npm install will install version 1.25.0 or the latest minor or patch version such as 1.26.2.

However, npm update will not update your packages to new major versions. That means that "my-package" will not be update to 2.0.0 for instance.

I think using old version of packages can cause those kinds of warnings.
In that case, just reinstall the package to the latest version

npm uninstall my-package
npm i my-package

⚠️ But be careful as updating a package to a new major version could break your code!

My advice is to do it step by step and make sure you can always roll back in case there's a problem you don't understand!

  • Related