我是Angular 2/4的新手,在我跟随https://github.com/angular/angular-cli的命令之前它工作正常。我在我的机器上运行Angular 2-4。但是在一些Windows更新之后,我再也无法运行Angular了。它一直在说
我运行了以下命令并在github anugular CLI安装中执行了其他命令
>npm install -g @angular/cli or sometimes I ran npm install -g @angular/cli@latest
npm install
ng serve
当我运行npm install -g @ angular / cli时。这个消息得到了。
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\@angular\cli\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"
x64"})
npm WARN @schematics/angular@0.1.13 requires a peer of @angular-devkit/schematics@0.0.46 but none was installed.
npm WARN @schematics/schematics@0.0.13 requires a peer of @angular-devkit/schematics@0.0.46 but none was installed.
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" "-g" "@angular/cli@latest"
npm ERR! node v6.10.2
npm ERR! npm v3.10.10
npm ERR! path C:\Users\kislam\AppData\Roaming\npm\node_modules\@angular\cli
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\kislam\AppData\Roaming\npm\node_modules\@angular\cli' -> 'C:\Users\kislam\AppData\Roaming\
npm\node_modules\@angular\.cli.DELETE'
npm ERR! at moveAway (C:\Program Files\nodejs\node_modules\npm\lib\install\action\finalize.js:38:5)
npm ERR! at destStatted (C:\Program Files\nodejs\node_modules\npm\lib\install\action\finalize.js:27:7)
npm ERR! at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:267:18
npm ERR! at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\kislam\AppData\Roaming\npm\node_modules\@angular\cli' -> 'C:\Users\kislam\AppData\Roaming\
npm\node_modules\@angular\.cli.DELETE'
npm ERR! at Error (native)
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\kislam\AppData\Roaming\npm\node_modules\@angular\cli' -> 'C:\Users\kislam\AppData\Roaming
\npm\node_modules\@angular\.cli.DELETE'
npm ERR! at moveAway (C:\Program Files\nodejs\node_modules\npm\lib\install\action\finalize.js:38:5)
npm ERR! at destStatted (C:\Program Files\nodejs\node_modules\npm\lib\install\action\finalize.js:27:7)
npm ERR! at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:267:18
npm ERR! at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\kislam\AppData\Roaming\npm\node_modules\@angular\cli' -> 'C:\Users\kislam\AppData\Roaming\
npm\node_modules\@angular\.cli.DELETE'
npm ERR! at Error (native)
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:\Users\kislam\Documents\Angular\dynamicform-jan72017\npm-debug.log
npm ERR! code 1
之后我跑了:
npm install 服务
我也按照https://github.com/angular/angular-cli
中的步骤进行操作似乎无法正常工作
错误我在运行ng serve
C:\Temp\angular\dynamicformjan72017>ng serve
'ng' is not recognized as an internal or external command,
operable program or batch file.
答案 0 :(得分:0)
您的全局安装的@angular/cli
软件包似乎无法正常运行。
您应该尝试卸载/重新安装或更改文件夹选项(只读)。通常,由于Windows上的读/写权限而导致EPERM
错误。
此链接可帮助您正确执行此操作:https://github.com/angular/angular-cli#updating-angular-cli
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli