Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
458 views
in Technique[技术] by (71.8m points)

javascript - npm-EPERM:Windows上不允许进行此操作(npm - EPERM: operation not permitted on Windows)

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.(运行该命令后,当尝试在Windows OS上运行任何npm命令时,我不断收到以下内容。)

Error: EPERM: operation not permitted, mkdir 'C:Program Files (x86)Gitlocal'
at Error (native)

Have deleted all files from(已从删除所有文件)

C:Users<your username>.configconfigstore

It did not work.(这没用。)

Any suggestion ?(有什么建议吗?)

  ask by Lahar Shah translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Running this command was my mistake.(运行此命令是我的错误。)

npm config set prefix /usr/local(npm config设置前缀/ usr / local)

Path /usr/local is not for windows.(路径/usr/local不适用于Windows。)

This command changed the prefix variable at 'C:\Program Files (x86)\Git\local'(此命令在'C:\Program Files (x86)\Git\local'处更改了前缀变量)

To access and make a change to this directory I need to run my cmd as administrator.(要访问此目录并进行更改,我需要以管理员身份运行cmd。)

So I did:(所以我做了:)

  1. Run cmd as administrator(以管理员身份运行cmd)
  2. Run npm config edit (You will get notepad editor)(运行npm config edit (您将获得记事本编辑器))
  3. Change prefix variable to C:\Users\<User Name>\AppData\Roaming\npm(将prefix变量更改为C:\Users\<User Name>\AppData\Roaming\npm)

Then npm start works in a normal console.(然后, npm start在普通控制台中工作。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...