Angular-CLI ng new:"错误:EPERM:不允许操作......"

use*_*717 7 angular-cli angular

我正在尝试使用Angular-CLI安装新的Angular2应用程序,但仍然遇到以下问题:

ng new payment-calc-app

在"通过npm安装工具包"之后,我得到以下错误代码:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! path C:\Users\jweston\Documents\Apps\payment-calc-app\node_modules\.staging\rxjs-ccea9159
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\jweston\Documents\Apps\payment-calc-app\node_modules\.staging\rxjs-ccea9159' -> 'C:\Users\jweston\Documents\Apps\payment-calc-app\node_modules\rxjs'
npm ERR!     at destStatted (C:\Users\jweston\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:29:7)
npm ERR!     at C:\Users\jweston\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
npm ERR!     at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\jweston\Documents\Apps\payment-calc-app\node_modules\.staging\rxjs-ccea9159' -> 'C:\Users\jweston\Documents\Apps\payment-calc-app\node_modules\rxjs'
npm ERR!     at Error (native)
npm ERR!  { Error: EPERM: operation not permitted, rename 'C:\Users\jweston\Documents\Apps\payment-calc-app\node_modules\.staging\rxjs-ccea9159' -> 'C:\Users\jweston\Documents\Apps\payment-calc-app\node_modules\rxjs'
npm ERR!     at destStatted (C:\Users\jweston\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:29:7)
npm ERR!     at C:\Users\jweston\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
npm ERR!     at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\jweston\Documents\Apps\payment-calc-app\node_modules\.staging\rxjs-ccea9159' -> 'C:\Users\jweston\Documents\Apps\payment-calc-app\node_modules\rxjs'
npm ERR!     at Error (native) parent: 'payment-calc-app' }
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\jweston\AppData\Roaming\npm-cache\_logs\2017-03-23T19_17_36_190Z-debug.log

Package install failed, see above.
Run Code Online (Sandbox Code Playgroud)

我尝试npm clean cache并以管理员身份运行命令提示符(我在Windows上)无济于事.

奇怪的是,当我尝试删除安装失败的文件夹时,Windows阻止我删除它们,说我需要成为管理员来删除它们,即使我是管理员.我需要进入每个单独的文件夹并一次删除一个单独的文件.

mau*_*844 8

在我的情况下,问题是我有另一个'ng serve'运行的命令提示符,我停止了进程并且创建成功完成


Yog*_*til 7

  • 使用命令: npm install -g @angular/cli --no-optional
  • 关闭当前角度项目文件夹(在这种情况下payment-calc-app)
  • 授予父文件夹读写权限和存档权限(右键单击父文件夹并授予文件夹和子
    文件夹权限)
    • NodeJs以管理员模式打开命令提示符
    • 运行命令 ng new payment-calc-app


Hyd*_*hie 0

亲爱的 Angular 2 程序员,为了生存,这个错误很痛苦,无法通过 npm 缓存清理、重新启动或其他我已知的方法解决...只需卸载以前的节点版本并安装新的当前版本@ https://nodejs。 org/en/download/current/ - 这解决了我机器上的错误..祝你好运!