【问题标题】:Getting Error when running install command运行安装命令时出现错误
【发布时间】:2017-02-24 16:13:36
【问题描述】:

无法理解为什么会出现此错误,我也尝试以管理员身份运行该命令。

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--color=always"
npm ERR! node v6.9.5
npm ERR! npm  v3.10.10
npm ERR! path C:\csf_workflow\Projects\DataCentralUI\Main\DataCentral\node_modules\node-sass\vendor\win32-x64-48\binding.node
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink

npm ERR! Error: EPERM: operation not permitted, unlink 'C:\XXXXXXXXXXXXX\node_modules\node-sass\vendor\win32-x64-48\binding.node'
npm ERR!     at Error (native)
npm ERR!  { Error: EPERM: operation not permitted, unlink 'C:\XXXXXXXXXXXXXXX\node_modules\node-sass\vendor\win32-x64-48\binding.node'
npm ERR!     at Error (native)
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path: 'C:\\XXXXXXXXXXXXXXXXXX\\node_modules\\node-sass\\vendor\\win32-x64-48\\binding.node',
npm ERR!   parent: 'datacentralui' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\XXXXXXXXXXXXXXXXX\npm-debug.log

【问题讨论】:

  • 我使用 git bash shell 并且它正常工作。另一个选项是右键单击您的命令图标并以管理员身份运行它,然后尝试安装。
  • 我尝试以管理员身份运行,同样的错误
  • 你试过清除 NPM 缓存吗?
  • 你试过运行“npm rebuild node-sass”吗?出于好奇,你在使用 Yarn 吗? github.com/sass/node-sass/issues/1804

标签: angular npm-install webpack-2


【解决方案1】:

首先,尝试:

npm cache clean

如果这不能解决问题,则可能是清理没有完全成功,并且仍有残留物。查看 %APPDATA%\npm-cache,或者如果您使用 PowerShell,请查看 $env:APPDATA\npm-cache。手动删除该目录中的所有内容,然后重试。

参考:

http://blogs.msdn.microsoft.com/matt-harrington/2012/02/23/how-to-fix-node-js-npm-permission-problems/)

【讨论】:

    最近更新 更多