I ran
npm config set prefix /usr/local
After running that command, When trying to run any npm commands on Windows OS I keep getting the below.
Error: EPERM: operation not permitted, mkdir 'C:\Program Files (x86)\Git\local'
at Error (native)
Have deleted all files from
C:\Users\<your username>\.config\configstore\
It did not work.
Any suggestion ?
Running this command was my mistake.
npm config set prefix /usr/local
Path /usr/local
is not for windows. This command changed the prefix variable at 'C:\Program Files (x86)\Git\local'
To access and make a change to this directory I need to run my cmd as administrator.
So I did:
- Run cmd as administrator
- Run
npm config edit
(You will get notepad editor) - Change
prefix
variable toC:\Users\<User Name>\AppData\Roaming\npm
Then npm start
works in a normal console.
I solved the problem by changing windows user access for the older:
Here is a screenshot: http://prntscr.com/djdn0g
I recently had the same problem when I upgraded to the new version, the only solution was to do the downgraded
To uninstall:
npm uninstall npm -g
Install the previous version:
npm install npm@5.3 -g
Try update the version in another moment.
This is occurring because windows is not giving permission to the user to create a folder inside system drive. To solve this:
Right Click
The Folder > Properties > Security Tab
Click on Edit to change Permissions > Select the user and give Full Control to that user.
Sometimes, all that's required is to stop the dev server before installing/updating packages.
I had the same problem, after updating npm. Solved it by re-installing latest npm again with:
npm i -g npm
but this time with cmd running in administrating mode.
i did all this because i suspected there was an issue with the update, mostly some missing files.
I use Windows 10. I started the CMD as administrator, and it solved the problem.
Find CMD, right click, and click open as administrator.
In my case, I was facing this error because my directory and its file were opened in my editor (VS code) while I was running npm install
. I solved the issue by closing my editor and running npm install
through the command line.
for me it was an issue of altering existing folders in node_module, so i nuked the whole folder and run npm install again. it works with no errors after that
I had the same problem when I tried to install the npm package AVA
. The solution for me was to delete the node_modules folder and force-clean the npm cache:
rm -rf node_modules
npm cache clean --force
I could then install the npm package without a problem.
I had the same issue, as I was using my company LAN. And I just ran cmd.exe npm
and I was able to execute my other commands without any error after that.
C:\Users\586656>cmd.exe npm
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.
Just sharing this, as it may help other folks who try to do this in their office LAN. Thank you.
Just run cmd as admin. delete old node_modules folder and run npm install again.
Happened to me since the folder/file was locked by another process. Used a tool (LockHunter) to terminate that process and it started working again (possible reason).
Find this command npm cache clean
as a solution to those error in quick and simple way!
I updated my node version to 8.9.4 and ran the necessary install command again from administrator command prompt. It worked for me!
A reboot of my laptop and then
npm install
worked for me!
Try to install npm package by running CMD as Administrator. you can headover to broad discussion on this bug at npm install throwing error EPERM.
Running npm commands in Windows Powershell solved my issue.
Try npm i -g npm . NPM version 6.9 is work to me.
Same to me, My solution was close Android studio, AVD Manager, Visual Studio and reinstall. I executed this command to update my expo cli:
npm install -g expo-cli
Simplest way
Hope I am not too late for this post but recently even I too got hit by this issue. And also I had no admin rights on my laptop.
Here is the simplest way I fixed the bug.
- Locate the file name
.npmrc
(it will be inC:\Users\<user name>\.npmrc
) - Open it and change the path of
prefix=
toprefix=C:\Users\<user name>\AppData\Roaming\npm
hope it will be helpful..
来源:https://stackoverflow.com/questions/34600932/npm-eperm-operation-not-permitted-on-windows