Dog
Dog

Reputation: 2916

Module Not Found error after NPM Install

I'm new to Node and after successfully running NPM init for a node project, attempted to install lodash through:

npm install lodash --save

However, after running that command, I got the error:

npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'internal/fs'

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/johnwolfe/.npm/_logs/2018-01-07T05_07_16_644Z-debug.log

I've also tried just running NPM install and I get the same error. What possible explanation is there for this error and how can I resolve it? I've tried other solutions on the web and nothing is working.

This is my package.json file:

{
  "name": "notes",
  "version": "1.0.0",
  "description": "",
  "main": "app.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
} 

Thank you for any insight!

Upvotes: 4

Views: 25392

Answers (4)

vineeth agarwal
vineeth agarwal

Reputation: 21

I was trying to launch a React application using webpack. I was getting module not found error even after installing it manually.error message even after installing the module

But "npm install" also gave below suggestion to run "npm audit fix"npm suggestion

  1. I did "npm audit fix" as suggested.
  2. It threw another error saying that existing version of another module does not meet the requirements of the latest version.
  3. I had to install that version manually.
  4. Then ran "npm audit fix" again and all the errors were resolved.

Upvotes: 0

Sasi Kumar M
Sasi Kumar M

Reputation: 2630

In my case, installation had issues as my intelliJ was not having enough permissions to create folders inside project workspace, following the below steps resolved my issue,

i) Ran my IntelliJ with administrator mode, but this was working for an instance after i restart i have to re-launch my IntelliJ again and this was an headache.

ii) Moved my workspace to path where IntelliJ has access to (earlier workspace was under users directory which was causing the permission issues).

Upvotes: 0

Dog
Dog

Reputation: 2916

I ended up having to do a deep uninstall of Node following this thread How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X) and then running Brew install Node again after resolving issues with symlinks.

Upvotes: 0

Sajeetharan
Sajeetharan

Reputation: 222722

Try the following ,

Delete all the dependencies of the project. Reinstall.

rm -rf node_modules
npm install

Upvotes: 3

Related Questions