Npm Please try using this command again as root/administrator
It turns out that you don’t have to run the command again as Administrator, and doing so won’t fix the problem.
Try:
npm cache clean
first.If that doesn’t fix things, take a look in
%APPDATA%\npm-cache
, or if you’re using PowerShell,$env:APPDATA\npm-cache
.
After cleaning the cache, you may still be left with remnants. Manually remove everything in that directory, and try again. This has always fixed things for me.
As @Crazzymatt was mentioning, as of the npm@5 version and up, we need to use npm cache verify
instead of npm cache clean
. Or else you will get an error as preceding.
npm ERR! As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead.
(Source: MSDN Blog post)
I solve it running as administrator cmd.
Cleaning the cache
npm cache clean -f
And then try to install the package again
You should run cmd.exe as administrator.
Follow the following steps:
- Click Start, click All Programs, and then click Accessories.
- Right-click Command prompt, and then click Run as administrator.
Here is how I fixed this on my Windows (7) Dev. environment. I assume the following...
- You are Running Command Prompt, Git Bash, Cmder or your favorite Terminal, as an Administrator by right clicking
- Privileges Permissions have been granted for Read/Write (i.e chmod -777)
Okay, let's get to it:
-
Update any packages where a version check is returning a warning ("npm WARN"..) for example...
npm update -g npm
npm update -g graceful-fs
-
Next we want to force a cache clean. This is flagged by an '--f' or '-f'..
npm cache clean --f
In Widows Explorer search for the following path
%APPDATA%\npm-cache
And Delete it's contents
- Start a fresh instance of your Terminal, remembering to 'Right-Click' and 'Run as Administrator', install the packages again.
Hope this helps someone!!
I was already running the Node Command Window as Administrator. As mentioned by many above, the following command with --f (force) solved my issue.
npm cache clean -f
After the Cache Clean, the install was flawless. See the screenshot for reference