【问题标题】:ng new hello-world not working and npm cache clean not working toong new hello-world 不工作,npm cache clean 也不工作
【发布时间】:2018-07-05 00:23:59
【问题描述】:

我在尝试生成新应用并尝试 ng cache clean --force 时收到此错误,但它不起作用 试图重新安装 node.js 和 npm 以及 angular cli,但这些都不适合我 我知道这可能看起来像是重复的,但即使我写 npm cache clean --force 也不是我有这个

C:\Users\ahmed\Desktop>npm cache clean --force
npm WARN using --force I sure hope you know what you are doing.

C:\Users\ahmed\Desktop>ng new hello-world
CREATE hello-world/angular.json (3593 bytes)
CREATE hello-world/package.json (1315 bytes)
CREATE hello-world/README.md (1027 bytes)
CREATE hello-world/tsconfig.json (384 bytes)
CREATE hello-world/tslint.json (2805 bytes)
CREATE hello-world/.editorconfig (245 bytes)
CREATE hello-world/.gitignore (503 bytes)
CREATE hello-world/src/environments/environment.prod.ts (51 bytes)
CREATE hello-world/src/environments/environment.ts (631 bytes)
CREATE hello-world/src/favicon.ico (5430 bytes)
CREATE hello-world/src/index.html (297 bytes)
CREATE hello-world/src/main.ts (370 bytes)
CREATE hello-world/src/polyfills.ts (3194 bytes)
CREATE hello-world/src/test.ts (642 bytes)
CREATE hello-world/src/assets/.gitkeep (0 bytes)
CREATE hello-world/src/styles.css (80 bytes)
CREATE hello-world/src/browserslist (375 bytes)
CREATE hello-world/src/karma.conf.js (964 bytes)
CREATE hello-world/src/tsconfig.app.json (194 bytes)
CREATE hello-world/src/tsconfig.spec.json (282 bytes)
CREATE hello-world/src/tslint.json (314 bytes)
CREATE hello-world/src/app/app.module.ts (314 bytes)
CREATE hello-world/src/app/app.component.html (1141 bytes)
CREATE hello-world/src/app/app.component.spec.ts (994 bytes)
CREATE hello-world/src/app/app.component.ts (207 bytes)
CREATE hello-world/src/app/app.component.css (0 bytes)
CREATE hello-world/e2e/protractor.conf.js (752 bytes)
CREATE hello-world/e2e/src/app.e2e-spec.ts (307 bytes)
CREATE hello-world/e2e/src/app.po.ts (208 bytes)
CREATE hello-world/e2e/tsconfig.e2e.json (213 bytes)
npm WARN deprecated istanbul-lib-hook@1.2.1: 1.2.0 should have been a major 
version bump
[ .................] - fetchMetadata: sill pacote version manifest for 
parseuri@0.0.5 fetched in 404ms

【问题讨论】:

    标签: angular npm angular5 angular6


    【解决方案1】:

    你试过了吗?

    npm uninstall -g angular-cli
    npm cache clean
    npm install -g angular-cli@latest
    

    【讨论】:

    • npm 错误!路径 C:\Users\ahmed\AppData\Roaming\npm\node_modules\.staging\angular-cli-15394168\upgrade\version.js npm ERR!代码 EPERM npm 错误! errno -4048 npm 错误!系统调用取消链接 npm ERR!错误:EPERM:不允许操作,取消链接 'C:\Users\ahmed\AppData\Roaming\npm\node_modules\.staging\angular-cli-15394168\upgrade\version.js' npm ERR! { 错误:EPERM:不允许操作,取消链接 'C:\Users\ahmed\AppData\Roaming\npm\node_modules\.staging\angular-cli-15394168\upgrade\version.js' npm ERR!原因:
    • npm 错误! { 错误:EPERM:不允许操作,取消链接 'C:\Users\ahmed\AppData\Roaming\npm\node_modules\.staging\angular-cli-15394168\upgrade\version.js' npm ERR!错误号:-4048,npm 错误!代码:'EPERM',npm 错误!系统调用:'取消链接',npm ERR!路径:'C:\\Users\\ahmed\\AppData\\Roaming\\npm\\node_modules\\.staging\\angular-cli-15394168\\upgrade\\version.js' },npm 错误!堆栈:'错误:EPERM:不允许操作,取消链接 \'C:\\Users\\ahmed\\AppData\\Roaming\\npm\\node_modules\\.staging\\angular-cli-15394168\\upgrade\\ version.js\'',npm 错误!错误号:-4048,
    • npm 错误!代码:'EPERM',npm 错误!系统调用:'取消链接',npm ERR!路径:'C:\\Users\\ahmed\\AppData\\Roaming\\npm\\node_modules\\.staging\\angular-cli-15394168\\upgrade\\version.js' } npm 错误! npm 错误!该操作被您的操作系统拒绝。 npm 错误!该文件可能已被使用(由文本编辑器或防病毒软件),npm ERR!或者您没有访问它的权限。 npm 错误! npm 错误!如果您认为这可能是权限问题,请仔细检查 npm ERR!文件及其包含目录的权限,或尝试运行
    • npm 错误!再次以 root/Administrator 身份执行该命令(尽管不建议这样做)。
    【解决方案2】:

    试试这个(根据https://docs.npmjs.com/cli/audit

    npm audit fix
    

    它将扫描您的项目的漏洞并自动安装任何兼容的更新到易受攻击的依赖项

    【讨论】:

      猜你喜欢
      • 2018-02-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-11
      • 2013-12-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多