npm - EPERM: operation not permitted on Windows

我是研究僧i 提交于 2019-11-27 00:44:00
Lahar Shah

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:

  1. Run cmd as administrator
  2. Run npm config edit (You will get notepad editor)
  3. Change prefix variable to C:\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.

RatneZ

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.

DIANGELISJ

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.

  1. Locate the file name .npmrc (it will be in C:\Users\<user name>\.npmrc)
  2. Open it and change the path of prefix= to prefix=C:\Users\<user name>\AppData\Roaming\npm

hope it will be helpful..

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!