I just updated npm
to 5.4.0
.
Now, Whenever I want install a npm package I get the following error:
D:\\Sources\\DownloadCms\\Md
I got the same problem just doing an npm install. Run with antivirus disabled (if you use Windows Defender, turn off Real-Time protection and Cloud-based protection). That worked for me!
I was able to fix this by running the command prompt/bash as admin and closing VSCode! Seems like VSCode was locking some files. Potentially something else could be locking these files for you.
In my case, i was facing similar issue while running multiple instance of 'npm install' on VM used for build(Windows)
Since it was a VM used only for build there was no other program locking the files. I tried disabling various antivirus settings which didn't worked. "npm cache clear" and "npm cache verify" worked but it was not a right solution for me as i cannot guess when somebody will trigger a build job from Jenkins for different release/environment leading to multiple instance of 'npm install' and hence i cannot add it to the build script nor i can go login to VM and clear/delete the cache folders manually every time.
Finally, after some research, I ended up running "npm install" with separate cache path for each job using following command:
npm install --cache path/to/some/folder
Since, all the jobs running at the same time now had a separate cache path rather than the common global path (Users/AppData/Roaming/), this issue got fixed as the jobs were no more trying to lock and access the same file, from the common npm cache.
Please note you can install a single package with a cache path as follows:
npm install packageName --cache path/to/some/folder
I was not able to find this way of giving a cache path in npm documentation but i gave it a try and it worked. I am using npm6 and looks like it works since npm5.
[Refer: How to specify cache folder in npm5 on install command?
This solution should work for other scenarios as well though may or may not be a good fit.
I had this logs in Windows. I did the following
I'm using VsCode
and solved this issue by stopping the application server and them run npm install
. There are files that were locked by the application server.
No need to close the IDE, just make sure there's no another process locking some files on your projects.
npm login
is required before publish