I\'ve been desperately trying to install modules using node.js but it always fails getting packages with npm.
I logged in as Administrator and used powershell/cmd wi
Try following steps
1. Run this command on Terminal or CMD - npm cache clean
2. Go to this folder on windows %APPDATA%\npm-cache
And delete folder which you want to install module (Ex:- laravel-elixir) or if you are using PowerShell, $env:APPDATA\npm-cache
3. Then Run your command EX:- npm install laravel-elixir
As my last resort with this error I created a fresh windows 10 virtual machine and installed the latest nodejs (v6). But there was a host of other "ERRs!" to work through.
I had to run npm cache clean --force
which ironically will give you a message that reads "I sure hope you know what you are doing". That seems to have worked.
It doesn't solve the issue on my main Dev machine. I'm canning nodejs as I found over the last few years that you spend more time on fixing it rather than on actual development. I had fewer issues with node on linux ubuntu 14.04 if that's any help.
This worked for me, if your package.json
is not too big you can do this:
node_modules
.npm install
again.I solve it running as administrator cmd.
Cleaning the cache
npm cache clean -f
And then try to install the package again
If you're using TFS or any other source control for your project that sets your checked in files to readonly mode, then you gotta make sure package.json is checked out before running npm install. I've made this mistake plenty of times.
npm cache verify
Try for newer versions of npm.
I'm using v 5.5.1 and it's working fine.