schenker
schenker

Reputation: 953

Cannot execute npm commands

while trying to install a gulp package, i had this error message.

module.js:471
throw err;
^

Error: Cannot find module './auth.js'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> 
(/usr/local/lib/node_modules/npm/node_modules/npm-registry- 
fetch/index.js:7:17)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)

Upon trying further i realised that i could not execute any other npm commands. It always showed this message. How can i fix this problem?

I have even tried doing this,

sudo rm -rf node_modules
npm install

But i always end up with this message again.

Thank you.

Upvotes: 2

Views: 474

Answers (2)

Fred
Fred

Reputation: 532

Your installation of npm is probably broken. I had the same issue after updating npm to 6.8.0 Normally, you would install a different version for npm using npm, but as that isn't going to work, you could download the NodeJs installer (from nodejs.org) and reinstall NodeJs. It (currently) comes with npm 6.4 which worked for me.

Upvotes: 1

schenker
schenker

Reputation: 953

This helped me

sudo n stable

Answer source: How can I update NodeJS and NPM to the next versions?

Upvotes: 1

Related Questions