Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node MODULE_NOT_FOUND

I just upgraded to node version 9.0.0 and am now getting this error in the command line when trying to use npm install

npm ERR! code MODULE_NOT_FOUND npm ERR! Cannot find module 'internal/util/types' 

I'm using:

  • OSX 10.10.5
  • Node version 9.0.0
  • NPM version 5.5.1

Extra information: I am also trying to do this with a Laravel 5.5 project. This is how I update my version of node: How do I update Node.js?

like image 248
user3325126 Avatar asked Nov 02 '17 19:11

user3325126


People also ask

How do I resolve Cannot find module error using node JS?

To solve the "Cannot find module" error in Node. js, make sure to install the package from the error message if it's a third party package, e.g. npm i somePackage . If you get the error with a local module, make sure to point the node command to a file that exists.

How fix npm module not found?

If you have run the npm install command before, then it's possible that the installation of the module is incomplete or corrupted. Delete the node_modules/ folder using the rm -rf node_modules command, then run npm install again. That may fix the issue.

What is module not found error in node JS?

A module not found error can occur for many different reasons: The module you're trying to import is not installed in your dependencies. The module you're trying to import is in a different directory. The module you're trying to import has a different casing.

How do I resolve node modules error?

To fix the Cannot find module error, simply install the missing modules using npm . This will install the project's dependencies into your project so that you can use them. Sometimes, this might still not resolve it for you. In this case, you'll want to just delete your node_modules folder and lock file ( package-lock.


1 Answers

run

rm -rf /usr/local/lib/node_modules/npm  

and then re-install Node.js will work in most cases

like image 133
wrangler Avatar answered Sep 27 '22 19:09

wrangler