spice
spice

Reputation: 1512

NPM dead after update - cannot find module (OSX)

Just did a minor npm update to the latest version (I can't remember what it was as npm no longer works - hence the question) but I think my installed version before the update was 5.6.0. That could be wrong though.

Anyway after running...

sudo npm install -g npm

... npm no longer works at all. Anything I do results in :

internal/modules/cjs/loader.js:596
    throw err;
    ^

Error: Cannot find module './auth.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15)
    at Function.Module._load (internal/modules/cjs/loader.js:520:25)
    at Module.require (internal/modules/cjs/loader.js:650:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/index.js:7:17)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)

Any suggestions?

Upvotes: 5

Views: 1327

Answers (2)

Alex Shushunov
Alex Shushunov

Reputation: 11

I fixed this issue this way:

yarn global add npm

Upvotes: 1

spice
spice

Reputation: 1512

After trying a few different things including reinstalling node via brew the only thing that worked was to download and run the node installer binary from the node site.

Hope it helps somebody else.

Upvotes: 9

Related Questions