Angular-cli: Install fails on Windows 7

Created on 14 Jul 2016  Â·  29Comments  Â·  Source: angular/angular-cli

OS: Windows 7

Node/NPM Version (Install failed. Can't run ng):

node -v
v6.3.0 

npm -v
3.10.6

NOTE: Node version doesn't matter. Tested on 4.4.7 as well. No change.

Reproduction Steps:

Run npm install -g angular-cli on Windows 7

Log:

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Kyle\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\n
pm-cli.js" "install" "-g" "angular-cli"
npm ERR! node v6.3.0
npm ERR! npm  v3.10.6
npm ERR! path C:\Users\Kyle\AppData\Roaming\npm\node_modules\.angular-cli.DELETE\node_modules\traceur
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename

npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\Kyle\AppData\Roaming\npm\node_modules\.angular-cli.DE
LETE\node_modules\traceur' -> 'C:\Users\Kyle\AppData\Roaming\npm\node_modules\angular-cli\node_modules\traceur'
npm ERR!     at C:\Users\Kyle\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:64:7
npm ERR!     at C:\Users\Kyle\AppData\Roaming\npm\node_modules\npm\node_modules\slide\lib\async-map.js:52:35
npm ERR!     at Array.forEach (native)
npm ERR!     at C:\Users\Kyle\AppData\Roaming\npm\node_modules\npm\node_modules\slide\lib\async-map.js:52:11
npm ERR!     at Array.forEach (native)
npm ERR!     at asyncMap (C:\Users\Kyle\AppData\Roaming\npm\node_modules\npm\node_modules\slide\lib\async-map.js:51:8)

npm ERR!     at moveModules (C:\Users\Kyle\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:61:5)
npm ERR!     at C:\Users\Kyle\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:56:70
npm ERR!     at C:\Users\Kyle\AppData\Roaming\npm\node_modules\npm\node_modules\mkdirp\index.js:30:20
npm ERR!     at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\Kyle\AppData\Roaming\npm\node_modules\.angular-cli.DE
LETE\node_modules\traceur' -> 'C:\Users\Kyle\AppData\Roaming\npm\node_modules\angular-cli\node_modules\traceur'
npm ERR!     at Error (native)
npm ERR!  Error: EPERM: operation not permitted, rename 'C:\Users\Kyle\AppData\Roaming\npm\node_modules\.angular-cli.D
ELETE\node_modules\traceur' -> 'C:\Users\Kyle\AppData\Roaming\npm\node_modules\angular-cli\node_modules\traceur'
npm ERR!     at C:\Users\Kyle\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:64:7
npm ERR!     at C:\Users\Kyle\AppData\Roaming\npm\node_modules\npm\node_modules\slide\lib\async-map.js:52:35
npm ERR!     at Array.forEach (native)
npm ERR!     at C:\Users\Kyle\AppData\Roaming\npm\node_modules\npm\node_modules\slide\lib\async-map.js:52:11
npm ERR!     at Array.forEach (native)
npm ERR!     at asyncMap (C:\Users\Kyle\AppData\Roaming\npm\node_modules\npm\node_modules\slide\lib\async-map.js:51:8)

npm ERR!     at moveModules (C:\Users\Kyle\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:61:5)
npm ERR!     at C:\Users\Kyle\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:56:70
npm ERR!     at C:\Users\Kyle\AppData\Roaming\npm\node_modules\npm\node_modules\mkdirp\index.js:30:20
npm ERR!     at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:\Users\Kyle\AppData\Roaming\npm\node_modules\.angular-cli.DE
LETE\node_modules\traceur' -> 'C:\Users\Kyle\AppData\Roaming\npm\node_modules\angular-cli\node_modules\traceur'
npm ERR!     at Error (native)
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!     C:\Users\Kyle\npm-debug.log
npm ERR! code 1

NOTES:

1) Running as an administrator DOES NOT change anything. This includes if I EXPLICITY run cmd.exe as admin. It should not matter, but I tested it regardless...

2) I've already searched high and low for a solution. I saw some info that related to ember-cli, but any of the proposed solutions do not apply. For example, there was some info about missing a permission to create symlinks. Does not apply in my case; I have the permission.

3) I have typings installed globally already.

I can test this later on my personal computer (this is a corporate computer), but I don't feel it will do much good (that machine is running Windows 10).

help wanted bufix

Most helpful comment

I had the same problem with Win7 angular-cli installs.

It seems that Uninstalling node.js leaves an "npm" folder in the C:UsersAppDataRoaming directory. I deleted this folder, uninstalled and re-installed node.js, then angular-cli installed just fine.

All 29 comments

try running npm cache clean and then test it again

Ran npm clean cache and re-ran npm install -g angular-cli. No change.

Tested on my Win10 machine last night. Install ran without any errors.

I can't reproduce this myself on Windows 10, but leaving the issue open in case someone can help.

I had the same problem with Win7 angular-cli installs.

It seems that Uninstalling node.js leaves an "npm" folder in the C:UsersAppDataRoaming directory. I deleted this folder, uninstalled and re-installed node.js, then angular-cli installed just fine.

Long-shot, but Have you checked if any AV program is running?

On Jul 14, 2016, at 16:10, Kyle Crowley [email protected] wrote:

OS: Windows 7

Node/NPM Version (Install failed. Can't run ng):

node -v
v6.3.0

npm -v
3.10.6
NOTE: Node version doesn't matter. Tested on 4.4.7 as well. No change.

Reproduction Steps:

Run npm install -g angular-cli on Windows 7

Log:

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:Program Filesnodejsnode.exe" "C:UsersKyleAppDataRoamingnpmnode_modulesnpmbinn
pm-cli.js" "install" "-g" "angular-cli"
npm ERR! node v6.3.0
npm ERR! npm v3.10.6
npm ERR! path C:UsersKyleAppDataRoamingnpmnode_modules.angular-cli.DELETEnode_modulestraceur
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename

npm ERR! Error: EPERM: operation not permitted, rename 'C:UsersKyleAppDataRoamingnpmnode_modules.angular-cli.DE
LETEnode_modulestraceur' -> 'C:UsersKyleAppDataRoamingnpmnode_modulesangular-clinode_modulestraceur'
npm ERR! at C:UsersKyleAppDataRoamingnpmnode_modulesnpmlibinstallactionfinalize.js:64:7
npm ERR! at C:UsersKyleAppDataRoamingnpmnode_modulesnpmnode_modulesslidelibasync-map.js:52:35
npm ERR! at Array.forEach (native)
npm ERR! at C:UsersKyleAppDataRoamingnpmnode_modulesnpmnode_modulesslidelibasync-map.js:52:11
npm ERR! at Array.forEach (native)
npm ERR! at asyncMap (C:UsersKyleAppDataRoamingnpmnode_modulesnpmnode_modulesslidelibasync-map.js:51:8)

npm ERR! at moveModules (C:UsersKyleAppDataRoamingnpmnode_modulesnpmlibinstallactionfinalize.js:61:5)
npm ERR! at C:UsersKyleAppDataRoamingnpmnode_modulesnpmlibinstallactionfinalize.js:56:70
npm ERR! at C:UsersKyleAppDataRoamingnpmnode_modulesnpmnode_modulesmkdirpindex.js:30:20
npm ERR! at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:UsersKyleAppDataRoamingnpmnode_modules.angular-cli.DE
LETEnode_modulestraceur' -> 'C:UsersKyleAppDataRoamingnpmnode_modulesangular-clinode_modulestraceur'
npm ERR! at Error (native)
npm ERR! Error: EPERM: operation not permitted, rename 'C:UsersKyleAppDataRoamingnpmnode_modules.angular-cli.D
ELETEnode_modulestraceur' -> 'C:UsersKyleAppDataRoamingnpmnode_modulesangular-clinode_modulestraceur'
npm ERR! at C:UsersKyleAppDataRoamingnpmnode_modulesnpmlibinstallactionfinalize.js:64:7
npm ERR! at C:UsersKyleAppDataRoamingnpmnode_modulesnpmnode_modulesslidelibasync-map.js:52:35
npm ERR! at Array.forEach (native)
npm ERR! at C:UsersKyleAppDataRoamingnpmnode_modulesnpmnode_modulesslidelibasync-map.js:52:11
npm ERR! at Array.forEach (native)
npm ERR! at asyncMap (C:UsersKyleAppDataRoamingnpmnode_modulesnpmnode_modulesslidelibasync-map.js:51:8)

npm ERR! at moveModules (C:UsersKyleAppDataRoamingnpmnode_modulesnpmlibinstallactionfinalize.js:61:5)
npm ERR! at C:UsersKyleAppDataRoamingnpmnode_modulesnpmlibinstallactionfinalize.js:56:70
npm ERR! at C:UsersKyleAppDataRoamingnpmnode_modulesnpmnode_modulesmkdirpindex.js:30:20
npm ERR! at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:UsersKyleAppDataRoamingnpmnode_modules.angular-cli.DE
LETEnode_modulestraceur' -> 'C:UsersKyleAppDataRoamingnpmnode_modulesangular-clinode_modulestraceur'
npm ERR! at Error (native)
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! C:UsersKylenpm-debug.log
npm ERR! code 1
NOTES:

1) Running as an administrator DOES NOT change anything. This includes if I EXPLICITY run cmd.exe as admin. It should not matter, but I tested it regardless...

2) I've already searched high and low for a solution. I saw some info that related to ember-cli, but any of the proposed solutions do not apply. For example, there was some info about missing a permission to create symlinks. Does not apply in my case; I have the permission.

3) I have typings installed globally already.

I can test this later on my personal computer (this is a corporate computer), but I don't feel it will do much good (that machine is running Windows 10).

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

I am facing same issue on windows7 with
npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli@webpack
It is trying to rename angular-cli and having permission issues.

As an update, I've found similar reports that indicate this might be a windows specific NPM issue:
https://github.com/npm/npm/issues/12059
https://github.com/npm/npm/issues/10826

The issue:
C:\Users\<username>\AppData\Roaming\npm\node_modules\.angular-cli.DELETE

Solution:
Open windows explorer and navigate to:
C:\Users\<username>\AppData\Roaming\npm\node_modules\
Then delete folder named:
.angular-cli.DELETE
Optional, but suggested:
npm clear cache
Then run:
npm install -g angular-cli

Note:
.folder names are hidden by default. Show these files on Windows 7: http://www.bleepingcomputer.com/tutorials/show-hidden-files-in-windows-7/

@iamtracy that used to work for me in a few random cases when I had this happen. Not anymore.

Recently on Friday September 30 I was able to download angular-cli beta-16 globally in the morning (Sydney time), then during noon I was not able to upgrade to it from existing app using the CLI. Another friend was trying to install it globally but it failed too.

We both tried ensuring deleting the from and to names in the rename error, and clearing NPM cache, no luck.

Since these were corporate laptops (different models, running Windows 8.1, with admin access), I suspect that some antivirus update or so ran after I installed the CLI successfully for the last time. That's an antivirus I cannot disable unfortunately.

Now I cannot re-install the same version of the CLI that worked before, and it's failing consistently with the .DELETE error (although not always on the same folder). The usual tips (deleting folders, clearing npm cache, even uninstalling node -in this case 4.4.2 on one machine and 4.6 on another-, and also running npm install with --no-optional) all do not help.

I'm suspecting it's https://github.com/npm/npm/issues/12059 as @filipesilva said, and consider trying https://github.com/npm/npm/issues/12059#issuecomment-232180291 tomorrow at work, but we only see it in the CLI, which may be because the amount of depedencnies the CLI requires is huge and amplifies the exisiting npm problem by several magnititudes.

Closing all visual studio and SQL Management studio windows along with
npm cache clear
did the trick for me

This morning a friend confirmed he tried to install the CLI, got the rename .DELETE error, applied the change to NPM source (yuck) as in https://github.com/npm/npm/issues/12059#issuecomment-232180291, and was able to install the CLI.

This is with Node 4.4.2, NPM 3.10, on Windows 8.1 with admin access and McAfee antivirus we cannot disable.

So, it's probably the NPM issue. The question still is why it's way less likely to happen when installing other packages. The size of the CLI package (including dependencies) is the suspect reason.

In my case the install worked after deleting AppData\Roaming\npm\node_modules\.angular-cli.DELETE

Still experiencing this issue and none of the above solutions have worked, anyone have any other ideas?

It might be because you are running ng serve command somewhere in another terminal?

I got the similar error while I was running ng serve and at the same time trying to run npm install bootstrap@next (on my Windows 10 laptop).

Same error happens to me. If you want to just forget about the root cause and resolve it right away like me...what I did was to modify the rename script used by the npm installation process (in finalize.js):

"nodejs installation folder"node_modulesnpmlibutilsrename.js

function rename (from, to, cb) {
  var saved = new SaveStack(rename)
  fs.rename(from, to, function (er) {
    if (er) {
      console.log("rename error: " + from + " -> " + to);
      // you have 30 seconds to rename the folder manually
          // remember to rename it to .angular-cli.DELETE (don't forget the period)
          setTimeout(cb, 30 * 1000) 
          //return cb(saved.completeWith(er))
    } else {
      return cb()
    }
  })
}

I know this is not ideal but works for me. Don't forget to change the script back to it's original version after that.

@KyleCrowley @DannyWalsh066 @Darkmoth @itwasnoteasy
Is this issue resolved ?

I resolved it closing a running instance of ng serve.

Closing as solved/npm issue overall.

I struggled as many did above installing angular cli on Windows 7 behind a corporate proxy. Turns out, it seems to be the Windows cmd windows itself somehow causing the issue. I used Cygwin and it worked the first time.

Opened Cygwin as root - not sure if the root was necessary.

npm config set https_proxy=https://myusername:[email protected]:8080
npm cache clear
npm install -g @angular/cli

Issue resolved after starting command prompt as administrator and running the command

It was solved for me by executing the npm i @angular/cli -g from the command prompt instead of the node.js prompt.

i still experience the same error with windows 7. i followed all these but did not work. please help how can i install angular.

thanks in advance.

I tried after deleting the folder C:UsersUserAppDataRoamingnpmnode_modules@angularcli, it was able to install.

@Radhakanta you know that once you delete that folder you won't be able to use npm anymore, right? If yes, why are you sharing this? Don't share your ignorancy please.

C:Usersprimeiro.ultimoAppDataRoamingnpm>npm i @angular/cli -g
module.js:471
throw err;
^

Error: Cannot find module 'C:Usersprimeiro.ultimoAppDataRoamingnpmnode_modulesnpmbinnpm-cli.js'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3

Hello, I found a work around, I've got the same error while trying to install @angular/cli.

image

I've created mannually the directories that npm couldn't rename, and for each directory created i rerun "npm install -g @angular/cli" ( i did this for 4 directories ).

image

My Config:
Npm -v : 5.5.1
Node -V : 8.9.1
Win 7 Entreprise

It's most probably anti-virus causing issues.

  1. Run command prompt as Administrator.
  2. Ran npm clean cache.
    After run this command and return Error than run .
    ( npm cache clean --force )
  3. npm install -g angular-cli

@patelvasu
The npm package has been renamed to @angular/cli for a long time.
It is high time you upgrade it.

Also, your 2nd step is not necessary anymore.
In your case, all you need to do is:

  • npm uninstall -g angular-cli
  • npm install -g @angular/cli

You may have to look into upgrading your code base eventually, a lot things have changed since the npm package used to be called angular-cli.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NCC1701M picture NCC1701M  Â·  3Comments

delasteve picture delasteve  Â·  3Comments

rajjejosefsson picture rajjejosefsson  Â·  3Comments

daBishMan picture daBishMan  Â·  3Comments

sysmat picture sysmat  Â·  3Comments