Npm安装错误EPERM操作不允许

时间:2017-12-12 17:40:41

标签: node.js angular npm npm-install npm-start

因此,当今天尝试运行angular4项目时,我的第一个错误是:npm install eperm operation not permitted所以我想删除我的节点模块文件夹并重试。但运行npm install我正在运行此错误npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"。我已经关闭vscode尝试运行安装以确保没有锁定它。我已经尝试过npm cache clean,但会导致错误。enter image description here

今天的最新挣扎:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-
  cli.js',
1 verbose cli   'install',
1 verbose cli   '-g',
1 verbose cli   '@angular/cli@latest' ]
2 info using npm@5.5.1
3 info using node@v8.9.3
4 verbose npm-session 2a0bb102467943cf
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 error cb() never called!

管理员结果: enter image description here

有什么建议吗?

我的package.json看起来像这样:

{
 "name": "gamemanagement",
 "version": "0.0.0",
 "license": "MIT",
 "scripts": {
   "ng": "ng",
   "start": "ng serve",
   "build": "ng build",
   "test": "ng test",
   "lint": "ng lint",
   "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
  "@angular/animations": "^5.0.1",
  "@angular/cdk": "^5.0.0-rc0",
  "@angular/common": "^5.0.1",
  "@angular/compiler": "^5.0.1",
  "@angular/compiler-cli": "^5.0.1",
  "@angular/core": "^5.0.1",
  "@angular/forms": "^5.0.1",
  "@angular/http": "^5.0.1",
  "@angular/material": "^5.0.0-rc0",
  "@angular/platform-browser": "^5.0.1",
  "@angular/platform-browser-dynamic": "^5.0.1",
  "@angular/platform-server": "^5.0.1",
  "@angular/router": "^5.0.1",
  "@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.5",          
  "angular2-moment": "^1.7.0",
  "angular2-text-mask": "^8.0.4",  
  "angularfire2": "5.0.0-rc.3",
  "ap-angular2-fullcalendar": "^1.3.5",
  "bootstrap": "4.0.0-beta",
  "core-js": "^2.4.1",
  "firebase": "4.6.2",
  "font-awesome": "^4.7.0",
  "jquery": "^3.2.1",
  "moment": "^2.19.3",
  "ng2-date-picker": "^2.6.2",              
  "popper.js": "^1.12.9",
  "rxjs": "^5.4.2",
  "sweetalert2": "^7.0.9",
  "typescript": "^2.6.1",
  "zone.js": "^0.8.14"
 },
"devDependencies": {
"@angular/cli": "^1.5.3",
"@angular/compiler-cli": "^4.2.4",
"@angular/language-service": "^4.2.4",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "~3.2.0",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.3.3"
}

}

9 个答案:

答案 0 :(得分:3)

我有同样的问题。缓存清理和更新npm后一切正常。所以试着跑:

npm cache clean --force

npm install -g npm @ latest

答案 1 :(得分:2)

这个

有两个解决方案
  1. 您可以运行“ npm cache clean
  2. 您在管理员模式中运行命令提示符。

答案 2 :(得分:1)

尝试以下setps,希望这有帮助。

  • 更新Node.js

  • 命令提示符下的npm cache clean命令,以管理员身份

检查节点代理设置是否持久删除

npm config delete http-proxy
npm config delete https-proxy

答案 3 :(得分:0)

快速简单地尝试npm cache clean:)

答案 4 :(得分:0)

请自行安装出现错误的模块。

花费了很多时间并尝试了所有可能的建议之后,我发现安装错误所提及的特定模块可以整体解决问题:

例如: npm ERR! {错误:EPERM:不允许执行此操作,请取消链接“路径\文档” nts \ AngularProjects \ my-sample-app333 \ node_modules.staging@angular \ core-a3d1aa4 8 \ bundles \ core.umd.js

我运行: npm install -global @ angular / core

它为我修复了它!终于!

答案 5 :(得分:0)

我尝试了以上所有方法,但对我而言不起作用。
我复制了package.json的所有内容并删除了该文件。然后,我创建了一个新文件并将其全部复制,然后将其保存为package.json
修复了所有问题

答案 6 :(得分:0)

100%确定

首先删除项目文件夹。例如:myapp1

然后运行-> npm cache clean --force 命令

重新输入先前给出错误的命令。

答案 7 :(得分:0)

macOS Catalina ,

            npm init 

出错

       operation not permitted, uv_cwd

步骤 1:转到父文件夹

         cd ../
         

第 2 步:再次转到您的项目文件夹,

         cd  your-project-folder

就是这样。它有效。

答案 8 :(得分:0)

我也遇到了同样的问题,但是一旦我从项目中删除了 node_modules 文件夹和 package-lock.json,然后我再次使用 { {1}} 对我有用。 My project folder structure