angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Install fails on Windows 7

Open KyleCrowley opened this issue 10 years ago • 29 comments

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).

KyleCrowley avatar Jul 14 '16 20:07 KyleCrowley

try running npm cache clean and then test it again

cre8 avatar Jul 15 '16 08:07 cre8

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.

KyleCrowley avatar Jul 15 '16 18:07 KyleCrowley

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

filipesilva avatar Jul 28 '16 02:07 filipesilva

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

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

Darkmoth avatar Aug 07 '16 02:08 Darkmoth

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 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).

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

cds-amal avatar Aug 07 '16 02:08 cds-amal

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.

itwasnoteasy avatar Aug 23 '16 00:08 itwasnoteasy

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

filipesilva avatar Sep 13 '16 17:09 filipesilva

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 avatar Oct 01 '16 16:10 iamtracy

@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.

Meligy avatar Oct 03 '16 01:10 Meligy

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

madhavabhyankar avatar Oct 03 '16 14:10 madhavabhyankar

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.

Meligy avatar Oct 04 '16 00:10 Meligy

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

alexreidy avatar Dec 02 '16 22:12 alexreidy

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

DannyW909 avatar Dec 08 '16 14:12 DannyW909

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).

ikilled avatar Dec 20 '16 11:12 ikilled

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_modules\npm\lib\utils\rename.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.

TrisDing avatar Jan 06 '17 18:01 TrisDing

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

catull avatar Jan 23 '17 17:01 catull

I resolved it closing a running instance of ng serve.

supix avatar Jan 29 '17 11:01 supix

Closing as solved/npm issue overall.

filipesilva avatar Jan 30 '17 11:01 filipesilva

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

mrshlthmps avatar Mar 24 '17 22:03 mrshlthmps

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

phanimothukuri avatar Aug 04 '17 10:08 phanimothukuri