【发布时间】:2018-06-13 01:51:51
【问题描述】:
我尝试使用 npm 安装 angular cli。但是在执行命令 npm install -g @angular/cli 时出现以下错误。 我不是以管理员身份执行此命令,而是以用户身份执行此命令。
D:\AngularWorkstation>npm install -g @angular/cli
npm WARN sass-loader@6.0.6 requires a peer of node-sass@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm ERR! path **D:\node_modules\node_modules\@angular\cli\node_modules\which\package.json.365294863
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'D:\node_modules\node_modules\@angular\cli\node_modules\which\package.json.365294863' -> 'D:\node_modules\node_modules\@angular\cli\node_modules\which\package.json'
npm ERR! { Error: EPERM: operation not permitted, rename 'D:\node_modules\node_modules\@angular\cli\node_modules\which\package.json.365294863' -> 'D:\node_modules\node_modules\@angular\cli\node_modules\which\package.json'
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, rename 'D:\node_modules\node_modules\@angular\cli\node_modules\which\package.json.365294863' ->** 'D:\node_modules\node_modules\@angular\cli\node_modules\which\package.json'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'D:\\node_modules\\node_modules\\@angular\\cli\\node_modules\\which\\package.json.365294863',
npm ERR! dest: 'D:\\node_modules\\node_modules\\@angular\\cli\\node_modules\\which\\package.json' },
npm ERR! stack: 'Error: EPERM: operation not permitted, rename \'D:\\node_modules\\node_modules\\@angular\\cli\\node_modules\\which\\package.json.365294863\' -> \'D:\\node_modules\\node_modules\\@angular\\cli\\node_modules\\which\\package.json\'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rename',
npm ERR! path: 'D:\\node_modules\\node_modules\\@angular\\cli\\node_modules\\which\\package.json.365294863',
npm ERR! dest: 'D:\\node_modules\\node_modules\\@angular\\cli\\node_modules\\which\\package.json',
npm ERR! parent: '@angular/cli' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\techno\AppData\Roaming\npm-cache\_logs\2018-01-03T09_14_35_602Z-debug.log
*PS:我使用的是 Windows10 操作系统。我还尝试将 npm 全局路径更改为“D:\node_modules”以检查是否是由于权限问题。但是输出是一样的。
node --version : v7.7.2
npm --version : 4.1.2*
【问题讨论】:
-
尝试在 Window PowerShell 中运行安装命令。
标签: node.js angular npm angular-cli