2

I installed the latest version of Node.js on my computer.

Before installation, 'npm' command worked perfectly on cmd but after installing new node.js, it doesn't work at all.

Every command including 'npm' word doesn't work and throws errors. Even the npm.cmd file in npm directory itself doesn't work.

--- What I've tried ---

  • Delete Node.js and re-install + reboot my computer
  • Download lower version of node.js/npm and reinstall
  • Add PATH variable links to C:\nodejs, C:\~AppData\Roaming~\npm
  • Do npm cache clean
  • Delete .npmrc file

Error Message

This is full error message that repeatedly appears. I'm using Window 10 and I installed node.js version 10.15. Actually I really tried fix the problem by myself, so I tracked down the error message above.

It seems like real error happens here

npm_cli.js

It's a capture of npm_cli.js file in my npm directory. At 77th line, function returns errorHandler at 78th line after npm.load()~ starts. If I delete that error handling section(=78th line), code stops at 81th line when npm.config.get() functions starts.

Since the error message keep saying 'Cannot read 'get' of undefined', I thought there might be a problem in loading npm variable using directory path in a code. So I checked that part also, but I found no particular problem. Please help me=(

+) I'm doing these things in my office, which means that my internet connection is limited in somehow. But with the same condition, I used previous version of both node.js and npm without any problem! And now I downgraded the version, so I might have the similar version of it as like before.

1 Answers1

1

This seems to be an existing issue. You mentioned that you've already tried to delete .npmrc file, but the problem might be that there is a stray .npmrc folder in your user directory after the update and reinstall (see the bottom comments in the Github thread and also this answer).

Darth Veyda
  • 828
  • 2
  • 12
  • 23
  • Thank you so much. I solved the problem! I found the stray .npmrc file in my computer. Oddly, it didn't appear through a file explorer searching. – Katherine_lee Mar 20 '19 at 04:55
  • Good to hear :) The search might have missed it because there was an invisible (but still valid) character in the filename, or something like that - the important part is that you've found it. (If the answer helped, you can tick it as accepted :)) – Darth Veyda Mar 20 '19 at 05:03