2

When I am trying to run this command, it through error and NPM does not install completely.

Before this version of Node.js I also installed node-v8.9.1-x64.msi, but their same issue I was facing that's why I uninstalled and installed node-v6.11.0-x64

But still, I am not able to solve this issue.

Node Version: v6.11.0 NPM Version: 3.10.0

Error Message:

D:\angular\NPM>npm install -g @angular/cli
C:\Users\XXX\AppData\Roaming\npm
`-- (empty)

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\@a
ngular\cli\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "@angular/cli"
npm ERR! node v6.11.0
npm ERR! npm  v3.10.10
npm ERR! path C:\Users\XXX\AppData\Roaming\npm\node_modules\.staging\rxjs-8d
1ee8eb
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename

npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\XXX\AppData
\Roaming\npm\node_modules\.staging\rxjs-8d1ee8eb' -> 'C:\Users\XXX\AppData\R
oaming\npm\node_modules\@angular\cli\node_modules\rxjs'
npm ERR!     at destStatted (C:\Program Files\nodejs\node_modules\npm\lib\instal
l\action\finalize.js:25:7)
npm ERR!     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-f
s\polyfills.js:264:29
npm ERR!     at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\XXX\AppData
\Roaming\npm\node_modules\.staging\rxjs-8d1ee8eb' -> 'C:\Users\XXX\AppData\R
oaming\npm\node_modules\@angular\cli\node_modules\rxjs'
npm ERR!     at Error (native)
npm ERR!  { Error: EPERM: operation not permitted, rename 'C:\Users\XXX\AppD
ata\Roaming\npm\node_modules\.staging\rxjs-8d1ee8eb' -> 'C:\Users\XXX\AppDat
a\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs'
npm ERR!     at destStatted (C:\Program Files\nodejs\node_modules\npm\lib\instal
l\action\finalize.js:25:7)
npm ERR!     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-f
s\polyfills.js:264:29
npm ERR!     at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\XXX\AppData
\Roaming\npm\node_modules\.staging\rxjs-8d1ee8eb' -> 'C:\Users\XXX\AppData\R
oaming\npm\node_modules\@angular\cli\node_modules\rxjs'
npm ERR!     at Error (native) parent: '@angular/cli' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\angular\NPM\npm-debug.log
npm ERR! code 1
Vinit ...
  • 1,409
  • 10
  • 37
  • 66
  • have you tried with sudo? – kriss Nov 24 '17 at 08:43
  • I think sudo is linux command...I am trying to install this in Window 7 OS. – Vinit ... Nov 24 '17 at 08:46
  • try to open cmd as a admin – kriss Nov 24 '17 at 08:48
  • It could be caused by Windows Defender Real Time Protection. I struggle with this error constantly. There is probably a way to set specific exclusions, but I haven't been able to figure it out. I have to temporarily disable real time protection (and cloud-delivered protection) any time I want to install/upgrade the CLI, or even create a new project. It's such a pain, and the only thing keeping me from promoting the CLI to my team. – David Jan 24 '18 at 20:35

3 Answers3

3

Normally I'd say "use it with sudo" like

sudo npm install -g @angular/cli

But since you are on Windows, try with an elevated command prompt.
In other words: Start your console (CMD) as Administrator and run the command again.

If that doesn't work, type

npm cache clean

And then just run

npm install -g @angular/cli

again.

NullDev
  • 6,739
  • 4
  • 30
  • 54
0

For Angular 4+ project development, you should use latest node version v8.8.9. So that you won't face any errors related to any modules.

Amit Chigadani
  • 28,482
  • 13
  • 80
  • 98
Ashish
  • 1
  • 2
0

I have same issue while trying to install @angular/cli

I found the node.js version I had installed was 6.10. Then I upgraded my node.js to 8.10.0 and tried:

npm install -g @angular/cli works fine.

The old version of npm doesn't support new features of Angular.

sorak
  • 2,607
  • 2
  • 16
  • 24
Drisal
  • 123
  • 1
  • 7