16

I installed last version of Node.js (12.2 x64 windows) After I run cmd as administrator and try to call any npm command (except npm -v), cmd window is hanging. After Ctrl+C it returns

Terminate batch job (Y/N)?

enter image description here

I was trying to left cmd for several hours but it didn't give some results. It is strange because node.exe process is consuming CPU and memory quite hard.

I was trying to reinstall node.js several times without success.
I can't even get some debug information.

I faced such issue on my VM which I was using by connecting via rdp. Same version installed on my laptop works ok. On my VM I had Kaspersky antivirus, but after switching it off I got same result.

Did somebody face such issue? Is there some way to get more information problem? Could you please recommend me some way to resolve?

MarianD
  • 13,096
  • 12
  • 42
  • 54
  • Is there some node.js/npm community? Can somebody help me at least to find log files for node.js/npm activity? I can see from task manager that node.js is actively doing something but in doesn't write to console any information. So I believe it should write some debug information in some log file. I wrote to https://www.npmjs.com/support but they didn't respond me at all, which was very weird. I thought node.js/npm community was very active due to their popularity. – Alex Kapelyukhovskiy Apr 03 '15 at 08:53

6 Answers6

15

I've finally resolved my issue. According to suggestion from our local read me file

Node.js (with NPM) Note: On windows server machines, instead of node modules been installed at user %APPDATA% path, its better to install at a global path e.g c:\npm. This could be acheived by the npm command: $ npm config set prefix 'c:\npm' This is not required on individual developer's machine.

I've executed npm config set prefix 'c:\npm'.

As result it added prefix="'c:\\npm'" to my .npmrc file

This make node.js really crazy. It takes me about an hour to debug all these js scripts npm.js code.js etc... to find that it calls mkdirp with 'c:\\npm'\etc and it loop process forever.

MarianD
  • 13,096
  • 12
  • 42
  • 54
6

If anyone will encounter this problem in the future you need to find the npmrc file delete it and delete all configurations for node, delete node as well and install it, this should fix that. when deleting node some of the configurations aren't deleted so you have to delete it manually.

illya yurkevich
  • 226
  • 3
  • 6
  • To clarify things, uninstall nodejs, then go to C:\Users\{your user} and search for NPM via windows search. Then delete everything you find. It was a pain in the ass to understand why the hell it has been freezing. – Jurijs Kastanovs Jul 08 '19 at 10:48
5

It happenned for me too : I installed node only for my user on Windows 10, and managed to use npm by calling it using the full path "c:\Program Files\nodejs\npm"

I solved by using "c:\Program Files\nodejs\npm" config set prefix "c:\Program Files\nodejs" (setting the prefix to the full path to npm)

And the result was :

    λ cat c:\Users\<my_user_name>\.npmrc
    prefix=c:\Program Files\nodejs

Now eveything works fine.

3

It's if the prefix is not set correctly.

Just want to point out to those commenting -if you can't get access to the command line npm, then you can't run npm config, obviously.

Open up powershell and type notepad $HOME/.npmrc, and edit the line where it says prefix=... and change it to a valid one.

2

For clarity, when you call:

npm config set prefix 'c:\npm'

you are required to have the ' wrapping the path, but you need to remove them from the .npmrc file so that npm commands will work. So your resulting line in .npmrc file should look like:

prefix="c:\\npm"
corestruct00
  • 105
  • 8
1

Just delete the .nprmc file at User/%UserProfile% and now try the command if it dosents work even reinstall once.