2

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!

Dog
  • 2,120
  • 3
  • 18
  • 50
  • your package.json has no reference to lodash dependency - does the error you are describing happen **when you run** `npm install lodash --save` or when you do something else? – Jaromanda X Jan 07 '18 at 05:21
  • if i run npm install i get the same error – Dog Jan 07 '18 at 05:21
  • right ... you mean you get the error ... the same error suggests you also get the error when doing something else, but you haven't done anything else – Jaromanda X Jan 07 '18 at 05:22
  • if i run npm install or npm install lodash it happens, but i was able to run npm init and install the package.json file – Dog Jan 07 '18 at 05:23
  • ahh, I get it now. which version of nodejs and which version of npm do you have – Jaromanda X Jan 07 '18 at 05:24
  • node is 8.3.0 and npm is 5.3.0 – Dog Jan 07 '18 at 05:25

4 Answers4

1

Try the following ,

Delete all the dependencies of the project. Reinstall.

rm -rf node_modules
npm install
Sajeetharan
  • 186,121
  • 54
  • 283
  • 331
0

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.

Dog
  • 2,120
  • 3
  • 18
  • 50
0

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.
Piotr Labunski
  • 1,608
  • 4
  • 16
  • 22
-1

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).

Sasi Kumar M
  • 1,484
  • 1
  • 15
  • 20