简体   繁体   English

Npm 安装错误 EPERM 不允许操作

[英]Npm install error EPERM Operation not permitted

So when trying to run the angular4 project today my first error was : npm install eperm operation not permitted so I thought to delete my node modules folder and retry.因此,当今天尝试运行 angular4 项目时,我的第一个错误是: npm install eperm operation not permitted所以我想删除我的节点模块文件夹npm install eperm operation not permitted试。 But running npm install I am running in to this error npm ERR! argv "C:\\\\Program Files\\\\nodejs\\\\node.exe" "C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\npm\\\\bin\\\\npm-cli.js" "start"但是运行 npm install 我遇到了这个错误npm ERR! argv "C:\\\\Program Files\\\\nodejs\\\\node.exe" "C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\npm\\\\bin\\\\npm-cli.js" "start" npm ERR! argv "C:\\\\Program Files\\\\nodejs\\\\node.exe" "C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\npm\\\\bin\\\\npm-cli.js" "start" . npm ERR! argv "C:\\\\Program Files\\\\nodejs\\\\node.exe" "C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\npm\\\\bin\\\\npm-cli.js" "start" I've closed vscode to try and run the install to make sure nothing was locking it.我已经关闭了 vscode 来尝试运行安装以确保没有任何东西锁定它。 I've tried npm cache clean but results in errors.我试过 npm cache clean 但导致错误。 在此处输入图片说明

Todays latest struggles :今日最新战况:

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!

Admin Results:管理结果: 在此处输入图片说明

Any suggestions?有什么建议么?

My package.json looks like this :我的 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"
}

} }

I had the same issue.我有同样的问题。 After cache clean and updating npm everything is ok.缓存清理和更新 npm 后一切正常。 So try to run:所以尝试运行:

npm cache clean --force npm 缓存清理 --force

npm install -g npm@latest npm install -g npm@latest

There are 2 solutions for this有2个解决方案

  1. you can run " npm cache clean "你可以运行“ npm cache clean
  2. you run the command prompt in admin mode .您在管理员模式下运行命令提示符。

Try below setps, hope this helps.试试下面的setps,希望这会有所帮助。

  • Update Node.js更新 Node.js

  • npm cache clean command in Command prompt, try as admin命令提示符中的 npm cache clean 命令,以管理员身份尝试

check node proxy settings if persist remove them with below检查节点代理设置,如果坚持使用下面删除它们

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

Install by yourself the module that is giving the error.自行安装出现错误的模块。

After spending many hours and trying all the possible suggestions, I found that installing the specific module mentioned by the error globally fixed the issue:在花了很多时间并尝试了所有可能的建议之后,我发现安装错误提到的特定模块全局修复了这个问题:

For Example: npm ERR!例如:npm ERR! { Error: EPERM: operation not permitted, unlink 'Path\\Docume nts\\AngularProjects\\my-sample-app333\\node_modules.staging@angular\\core-a3d1aa4 8\\ bundles\\core.umd.js { 错误: EPERM: operation not allowed, unlink 'Path\\Docume nts\\AngularProjects\\my-sample-app333\\node_modules.staging@angular\\core-a3d1aa4 8\\ bundles\\core.umd.js

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

and it fixed it for me!它为我修好了! Finally!!最后!!

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

I tried everything above but it did not work for me.我尝试了以上所有方法,但对我不起作用。
I copied all content of package.json and deleted the file.我复制了 package.json 的所有内容并删除了该文件。 Then, I created a new file and copied all there and I saved it as package.json然后,我创建了一个新文件并复制了所有内容并将其保存为 package.json
That fixed everything那解决了一切

100% sure 100%确定

Firstly delete the project folder.首先删除项目文件夹。 eg: myapp1例如:myapp1

Then run -> npm cache clean --force command然后运行 ​​-> npm cache clean --force命令

Retype the command that gives error previously.重新键入之前给出错误的命令。

macOS catalina , macOS 卡特琳娜,

            npm init 

got error出错

       operation not permitted, uv_cwd

step 1: go to parent folder第 1 步:转到父文件夹

         cd ../
         

step 2: go to your project folder again,第 2 步:再次转到您的项目文件夹,

         cd  your-project-folder

That is it.就是这样。 it works.有用。

I also faced the same issue but once I removed node_modules folder along with package-lock.json from the project and then I re-installed entire thing again with npm i it worked for me.我也遇到了同样的问题,但是一旦我从项目中删除了node_modules文件夹和package-lock.json ,然后我再次使用npm i重新安装了整个东西,它对我有用 我的项目文件夹结构

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM