2

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.

1
  • Did you upgrade NPM recently? Commented Mar 27, 2019 at 22:25

2 Answers 2

1

This helped me

sudo n stable

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

Sign up to request clarification or add additional context in comments.

1 Comment

This helps, because 'n' is a Node version switcher, which means it switches you to a new version of Node (which includes a different version of NPM). So it's the same fix as the other answer, but quite convenient.
1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.