Katherine_lee
Katherine_lee

Reputation: 39

My npm is totally broken after upgrade - 'Cannot read property 'get' of undefined'

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

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.

Upvotes: 2

Views: 378

Answers (1)

Darth Veyda
Darth Veyda

Reputation: 888

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

Upvotes: 1

Related Questions