Angular 版本 8 - 每次做 NG NEW 的努力都以 npm ERR 告终!错误:EPERM:不允许操作,取消链接 [英] Angular Version 8 - Every effort to do NG NEW ends in npm ERR! Error: EPERM: operation not permitted, unlink

查看:20
本文介绍了Angular 版本 8 - 每次做 NG NEW 的努力都以 npm ERR 告终!错误:EPERM:不允许操作,取消链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在标准 Windows 10 上以管理员身份运行以下命令.

I run the following commands as administrator on a standard Windows 10.

我按照书安装了 angular(版本 8)...

I installed angular (ver 8), as per book...

D:\>npm install -g @angular/cli
C:\Users\ThinkInCode\AppData\Roaming\npm\ng -> C:\Users\ThinkInCode\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng

> @angular/cli@8.3.8 postinstall C:\Users\ThinkInCode\AppData\Roaming\npm\node_modules\@angular\cli
> node ./bin/postinstall/script.js

+ @angular/cli@8.3.8
added 244 packages from 185 contributors in 155.387s

D:\>cd wamp64\www\NGAPPS\UDEMY

D:\wamp64\www\NGAPPS\UDEMY>ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 8.3.8
Node: 12.11.0
OS: win32 x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.803.8
@angular-devkit/core         8.3.8
@angular-devkit/schematics   8.3.8
@schematics/angular          8.3.8
@schematics/update           0.803.8
rxjs                         6.4.0

继续创建我的项目...

The went on to creating my project...

D:\wamp64\www\NGAPPS\UDEMY>ng new NG8-APP --routing
? Which stylesheet format would you like to use? CSS
CREATE NG8-APP/angular.json (3617 bytes)
CREATE NG8-APP/package.json (1283 bytes)
CREATE NG8-APP/README.md (1025 bytes)
CREATE NG8-APP/tsconfig.json (543 bytes)
CREATE NG8-APP/tslint.json (1953 bytes)
CREATE NG8-APP/.editorconfig (246 bytes)
CREATE NG8-APP/.gitignore (631 bytes)
CREATE NG8-APP/browserslist (429 bytes)
CREATE NG8-APP/karma.conf.js (1021 bytes)
CREATE NG8-APP/tsconfig.app.json (270 bytes)
CREATE NG8-APP/tsconfig.spec.json (270 bytes)
CREATE NG8-APP/src/favicon.ico (948 bytes)
CREATE NG8-APP/src/index.html (294 bytes)
CREATE NG8-APP/src/main.ts (372 bytes)
CREATE NG8-APP/src/polyfills.ts (2838 bytes)
CREATE NG8-APP/src/styles.css (80 bytes)
CREATE NG8-APP/src/test.ts (642 bytes)
CREATE NG8-APP/src/assets/.gitkeep (0 bytes)
CREATE NG8-APP/src/environments/environment.prod.ts (51 bytes)
CREATE NG8-APP/src/environments/environment.ts (662 bytes)
CREATE NG8-APP/src/app/app-routing.module.ts (246 bytes)
CREATE NG8-APP/src/app/app.module.ts (393 bytes)
CREATE NG8-APP/src/app/app.component.html (25530 bytes)
CREATE NG8-APP/src/app/app.component.spec.ts (1107 bytes)
CREATE NG8-APP/src/app/app.component.ts (213 bytes)
CREATE NG8-APP/src/app/app.component.css (0 bytes)
CREATE NG8-APP/e2e/protractor.conf.js (810 bytes)
CREATE NG8-APP/e2e/tsconfig.json (214 bytes)
CREATE NG8-APP/e2e/src/app.e2e-spec.ts (642 bytes)
CREATE NG8-APP/e2e/src/app.po.ts (262 bytes)
npm WARN tarball tarball data for @angular/compiler@~8.2.9 (sha1-8BQhStPcbrC/OVzSgpMWPQd6p7Q=) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for @angular/core@~8.2.9 (sha1-tOUwPWkijTA2KmShrkX46IpfLiQ=) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for typescript@~3.5.3 (sha1-yDD2V/k/HqhGgZ6SkJL1/lmD6Xc=) seems to be corrupted. Trying one more time.
npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path D:\wamp64\www\NGAPPS\UDEMY\NG8-APP\node_modules\.staging\@angular\core-3db91d17\fesm2015\core.js
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'D:\wamp64\www\NGAPPS\UDEMY\NG8-APP\node_modules\.staging\@angular\core-3db91d17\fesm2015\core.js'
npm ERR!  [OperationalError: EPERM: operation not permitted, unlink 'D:\wamp64\www\NGAPPS\UDEMY\NG8-APP\node_modules\.staging\@angular\core-3db91d17\fesm2015\core.js'] {
npm ERR!   cause: [Error: EPERM: operation not permitted, unlink 'D:\wamp64\www\NGAPPS\UDEMY\NG8-APP\node_modules\.staging\@angular\core-3db91d17\fesm2015\core.js'] {
npm ERR!     errno: -4048,
npm ERR!     code: 'EPERM',
npm ERR!     syscall: 'unlink',
npm ERR!     path: 'D:\\wamp64\\www\\NGAPPS\\UDEMY\\NG8-APP\\node_modules\\.staging\\@angular\\core-3db91d17\\fesm2015\\core.js'
npm ERR!   },
npm ERR!   stack: "Error: EPERM: operation not permitted, unlink 'D:\\wamp64\\www\\NGAPPS\\UDEMY\\NG8-APP\\node_modules\\.staging\\@angular\\core-3db91d17\\fesm2015\\core.js'",
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path: 'D:\\wamp64\\www\\NGAPPS\\UDEMY\\NG8-APP\\node_modules\\.staging\\@angular\\core-3db91d17\\fesm2015\\core.js',
npm ERR!   parent: 'NG8-APP'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\ThinkInCode\AppData\Roaming\npm-cache\_logs\2019-10-10T17_09_33_041Z-debug.log
Package install failed, see above.

一整天,再怎么努力也没有成功安装...

For a whole day, no amount of effort has yielded a successful installation...

禁用了防病毒软件并且多次重复安装,还重启我的机器,确保>VS Studio Code 关闭...,运行 npm cache clean,然后 npm cache clean --force,然后手动删除两个 npm 缓存npm 文件夹位于 %APPDATA% 路径下,然后使用 npm install -g @angular/cli 重新安装 angular 所有相同的 EPERM 错误,...不同的文件,但相同的错误.

I have disabled the antivirus and severally repeated the install, also reboot my machine, ensured VS Studio Code is closed..., run npm cache clean, then npm cache clean --force, then manually deleted both npm cache and npm folders under the %APPDATA% path and then reinstalled angular with npm install -g @angular/cli all to the same EPERM error,... different files but same error.

我在某处阅读了降级到版本的建议.7,但我不能,因为我需要 angular ver.8...此外,ver.8 应该以某种方式成功安装!由于某个 React Native 项目,我还需要一个相当新的 Node.js.我到底应该怎么做?请帮忙.

I have read somewhere recommendations to downgrade to ver. 7, but I can't because I need angular ver. 8... Besides, ver. 8 should install successfully somehow! I also need a fairly recent Node.js because of a certain React Native project. What on earth should I do differently?? Pls help.

推荐答案

尝试使用以下方法卸载 CLI:

Try to uninstall the CLI using:

npm uninstall -g @angular/cli

并使用以下方法重新安装:

and reinstall using:

npm install -g @angular/cli

这篇关于Angular 版本 8 - 每次做 NG NEW 的努力都以 npm ERR 告终!错误:EPERM:不允许操作,取消链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆