To resolve extraneous errors in the npm list output, you need to add the packages in your package. json file. Once the upgrade is done, run the npm list command again to see if the extraneous error is still there. Then run the npm install command to install the dependencies again.
extraneous means a package is installed but is not listed in your project's package. json . Since you're listing packages that have been installed globally, it's going to give you a lot of extraneous errors that can be simply ignored because most things installed globally will not be in your project's package.
Installing a package globally allows you to use the code in the package as a set of tools on your local computer. If you get an EACCES permissions error, you may need to reinstall npm with a version manager or manually change npm's default directory.
npm ERR! extraneous
means a package is installed but is not listed in your project's package.json
.
Since you're listing packages that have been installed globally, it's going to give you a lot of extraneous errors that can be simply ignored because most things installed globally will not be in your project's package.json
.
1 & 2: It means you don't have the jshint listed in your project's package.json file but that it is globally installed. So it is not a big problem.
3: To avoid this extraneous error, you can run or re-run the install with the option --save
. This will update automatically you package.json file :
npm install -g jshint --save
Or need to update manually your package.json file with a "dependencies": {...}
I resolved this by doing an npm update
in the parent package's folder which removed some of the extraneous packages from the list and then did npm uninstall <package>
for the remaining few.
Seems to have worked, as I'm getting no errors after doing this.
I solved it by combining all the answers. At first I installed the package globally.
npm install -g packagename --save
Since npm installed this packaged as well globally but did not add it to my local package.json file, I had to do something about it.
I choose, the solution to remove the local one and then install it globally.
npm uninstall packagename
npm install -g packagename
This way I have no more warnings and do not mess up the package.json file.
I my case, I saw this 'npm ERR! extraneous' message in my cygwin terminal when i did an 'npm ls'. I thought this was some sort of a globally corrupted setup after having lots of tinkering. I learn the following observations here:
I 'rm package.json' and 'npm ls' no longer shows error message. So I say, that always check the current location for the presence of 'node_modules' folder and the package.json file because these are prioritize first in the check and if these are missing, the check continues to to the parent folder and so on, and if you have tinkered a lot of code snippets a lot, then you may have scattered around lots and lots of node_modules folder and package.json file. Nothing is really corrupted here, unlike those experiences we have when doing J2EE Java development / eclipse IDE or during the days when we have to use regedit to change settings in Windows.
In my case it was because the package name in its package.json
file was not the same as the depency name listed in the package.json
of the dependent module. My error, since it's a new module I created, but hard to spot, since npm won't give any clue.
This happened when using the dependencies: { "my-module": "file:local-modules/mymodule" }
syntax, with a typo in the name "my-module".
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