Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

npm安装全局包时Error: EPERM: operation not permitted

安装命令:

cnpm install vue -g

错误如下:

Error: EPERM: operation not permitted, mkdir 'C:ProgramFiles
odejs
ode_modulesvue_tmp'
    at Error (native)
npminstall version: 2.25.0
npminstall args: C:Program Files
odejs
ode.exe C:UsersGaoKaiAppDataRoaming
pm
ode_modulescnpm
ode_modules
pminstallininstall.js --china --userconfig=C:UsersGaoKai.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://registry.npm.taobao.org vue -g

是全局安装包的问题?
还是cnpm本身的问题?


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

1 Answer

0 votes
by (71.8m points)

这个问题的本质是npm全局安装时需要管理员权限。
系统:windows10
平台:vscode
场景:vscode自带的集成终端powershell
最终解决方案:
1.开启新的powershell窗口后执行cnpm命令

Start-Process powershell -Verb runAs

2.打开新的gitbash窗口执行cnpm命令

Start-Process "C:Program FilesGitgit-bash.exe" –Verb runAs

3.打开新的cmd窗口执行cnpm命令

Start-Process "cmd.exe" –Verb runAs

另外也可以尝试下搜索后右键或win+xwin+ r 这三种方式,虽然这不专业。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...