npm “operation not permitted”

2019-07-10 03:53发布

问题:

Im building a small app in angular2.

node -v is v4.3.1, npm -v is 2.14.12

This command works ok : "npm i -g angular-cli". Then I try to do : "ng new ponyracer" and I get the following errors:

C:\Users\armyTik\Desktop\angular2>ng new ponyracer
installing ng2
  create .clang-format
  create config\environment.js
  create e2e\app.e2e.ts
  create e2e\app.po.ts
  create e2e\tsconfig.json
  create angular-cli-build.js
  create .gitignore
  create karma-test-shim.js
  create karma.conf.js
  create package.json
  create protractor.conf.js
  create src\app\ponyracer.html
  create src\app\ponyracer.spec.ts
  create src\app\ponyracer.ts
  create src\app.ts
  create src\favicon.ico
  create src\index.html
  create src\tsconfig.json
  create src\typings.d.ts
  create tslint.json
  create typings.json
EPERM: operation not permitted, rename 'C:\Users\armyTik\AppData\Roaming\npm-cache\inherits\2.0.1\package\package.json.9a4ce21d93c69060b63a1c0abc37dc9a' -> 'C:\Users\armyTik\AppData\Roaming
\npm-cache\inherits\2.0.1\package\package.json'
Error: EPERM: operation not permitted, rename 'C:\Users\armyTik\AppData\Roaming\npm-cache\inherits\2.0.1\package\package.json.9a4ce21d93c69060b63a1c0abc37dc9a' -> 'C:\Users\armyTik\AppData\
Roaming\npm-cache\inherits\2.0.1\package\package.json'
    at Error (native)

*I tryied to clean npm cache by doing : "npm cache clean".

回答1:

Run command prompt as administrator.



回答2:

I have faced the same problem when run the npm install command . I run the command as administrator but it's not worked for me. I have resolved my problem by doing the below steps

  1. Open command prompt
  2. npm cache clean --force (forcefully cleared the cache)
  3. Disabled my antivirus protection
  4. Finally run the npm install

    https://github.com/angular/angular-cli/issues/5611

My problem solved



标签: node.js npm