node 7.0.0, MODULE_NOT_FOUND internal/fs during npm install

Created on 29 Oct 2016  Ā·  31Comments  Ā·  Source: nodejs/node

  • Version: 7.0.0
  • Platform: Linux ux31a 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2+deb8u3 (2016-07-02) x86_64 GNU/Linux
  • Subsystem:

I just installed 7.0.0 and get the following error when installing dependencies:

screenshot from 2016-10-29 15 34 09

$ cat npm-debug.log 
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'i' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: Cannot find module 'internal/fs'
4 verbose stack     at Function.Module._resolveFilename (module.js:472:15)
4 verbose stack     at Function.Module._load (module.js:420:25)
4 verbose stack     at Module.require (module.js:500:17)
4 verbose stack     at require (internal/module.js:20:19)
4 verbose stack     at evalmachine.<anonymous>:17:20
4 verbose stack     at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/cmd-shim/node_modules/graceful-fs/fs.js:11:1)
4 verbose stack     at Module._compile (module.js:573:32)
4 verbose stack     at Object.Module._extensions..js (module.js:582:10)
4 verbose stack     at Module.load (module.js:490:32)
4 verbose stack     at tryModuleLoad (module.js:449:12)
5 verbose cwd /home/lms/src/level/leveldown
6 error Linux 3.16.0-4-amd64
7 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "i"
8 error node v7.0.0
9 error npm  v3.10.8
10 error code MODULE_NOT_FOUND
11 error Cannot find module 'internal/fs'
12 error If you need help, you may report this error at:
12 error     <https://github.com/npm/npm/issues>
13 verbose exit [ 1, true ]
fs npm

Most helpful comment

I wiped everything in /usr/local/lib/node_modules and reinstalled and now it works fine. Thanks for rubber ducking guys!

All 31 comments

That’s weird, there should be no /usr/local/lib/node_modules/npm/node_modules/cmd-shim/node_modules/graceful-fs at all – how/from where did you install npm?

I'm using n to install my node versions

There is no such file in the v7.0.0 tarball either, which is what n usually uses… are you sure you are using npm as it is packaged with Node?

Which version of npm should be installed with node 7.0.0? Is 3.10.8 correct?

I wiped everything in /usr/local/lib/node_modules and reinstalled and now it works fine. Thanks for rubber ducking guys!

[Solved] In my case, I installed node7 with .pkg in my Mac, and occurred the same error. Then I removed the /usr/local/lib/node_modules but find npm gone. Finally, I installed with .pkg again, and the issue cleared. Hope it helps to someone.

helped total reinstall nodeJS.

For me removing the /usr/local/lib/node_modules/npm directory and then switching with n between an old version and back to the stable version solved the issue, that way, there is no need for cleaning the entire node_modules directory.

I did a similar thing to @bollogo:

  1. switched to old version with n
  2. deleted npm folder ( /usr/local/lib/node_modules/npm )
  3. switched to new version with n
  4. :)

I had the same problem, so I decided to delete the version 7.0 and install the older version, 6. So i solved this problem

oh, yes, after i delete the version 7.0 i deleted too the folder 'node_modules'. So i install the version 6...

i have this problem; i've tried your solution but problem remains. Node version: 7.5.0; npm version: 4.1.2

I have the same issue, Node version: 7.5.0; npm version: 4.1.2

It seems to me that this was not a temporary problem since people keep having it and even running the latest version of node. Re-opening in hope to get some input.

There have been a couple of other bug reports but they all were able to fix it with either a clean reinstall or fixing up their dependencies (npm flattening + broad version range = outdated dep.)

I have no reason to believe it's an issue with node itself so I'll go ahead and close this out again if you don't mind.

If you installed using n try removing ~/n/lib/node_modules

I ran into the same issue on Windows after installing Node 7.7.3 into previous' installation folder (0.12.*).

npm installed with installer was 4.1.2, so I've downloaded newest npm (4.4.1) from registry and unpacked it into Node's node_modules. It works now :-)

I ran into this same problem installing with brew.
After deleting /usr/local/lib/node_modules as well as my local projects node_modules directory, and reinstalling node, I still had the issue.

Deleting ~/.node fixed the issue.

this seems to be an issue with gulp requiring an old versions of graceful-fs

npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.

I solved by first renaming npm folder to npm_todelete folder in C:\Usersxxx\AppData\Roamingnpmnode_modules dir
And then run npm i -g npm@4.
New npm folder will be and npm_todelete can be deleted!

I got this issue when I updated my node version to v7.9.0, And solved it via update gulp from [email protected] to [email protected]. So seems like it matchs what @hanakin described.

Upgrading to a newer version of Gulp fixed this for me when all the other solutions failed. Also note that the Gulp install said this:

"graceful-fsĀ v3.0.0Ā andĀ beforeĀ willĀ failĀ onĀ nodeĀ releasesĀ >=Ā v7.0.Ā PleaseĀ updateĀ toĀ graceful-fs@^4.0.0Ā asĀ soonĀ asĀ possible.Ā UseĀ 'npmĀ lsĀ graceful-fs'Ā toĀ findĀ itĀ inĀ theĀ tree."

Just upgrade node version using nvm and it should solve this issue.

same problem,I did like bollogo and it worked

I also had this problem. The following steps are the causes for the problem.
Step 1 : Executed the command npm outdated

C:\Program Filesnodejsnode_modulesnpm>npm outdated
Package Current Wanted Latest Location
request 2.81.0 2.81.0 2.83.0 npm

Step 2 : in package.json, i have changed request to latest version(2.83.0) which is higher than wanted version. so npm ERR! code MODULE_NOT_FOUND has came.

i did npm repair from control panel to solve this issue.

I did the same, I reinstalled everything again

Il 05/ott/2017 12:19, "naveento" notifications@github.com ha scritto:

I also had this problem. The following steps are the causes for the
problem.
Step 1 : Executed the command npm outdated

C:\Program Filesnodejsnode_modulesnpm>npm outdated
Package Current Wanted Latest Location
request 2.81.0 2.81.0 2.83.0 npm

Step 2 : in package.json, i have changed request to latest version(2.83.0)
which is higher than wanted version. so npm ERR! code MODULE_NOT_FOUND has
came.

i did reinstall to solve this issue.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/nodejs/node/issues/9355#issuecomment-334423072, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAWOk4H_aBqjYQkCLBC0DieY4ke7zWicks5spK0XgaJpZM4KkHV5
.

On my system an old npm version caused the problem. Reinstall with

$ rm -rf /usr/local/lib/node_modules/npm/
$ curl -0 -L https://npmjs.com/install.sh | sudo sh

fixed it.

For what it's worth (OS X 10.11.6) with a recently-updated Node.js (8.6.0), my previous gulp-related project then failed its "gulp serve" with the indicated error message.

  1. cat package.json |grep gulp
    "gulp": "^3.8.5",
  2. npm uninstall gulp --save-dev
  3. Using nano, manually added that line above back into package.json under devDependencies section
  4. npm install

It now works as expected. Note that I didn't upgrade my gulp, I just re-installed it locally in place.

å½“åˆ‡ę¢ Node 7 ++ļ¼Œå°±ä¼šå‡ŗēŽ°åŒę ·é—®é¢˜ć€‚
č§£å†³ę–¹ę”ˆļ¼šåœØåˆ‡ę¢Nodeļ¼ˆē‰ˆęœ¬>7ļ¼‰ę—¶ļ¼Œä¼šå…ˆåˆ é™¤npmē›®å½•ļ¼ˆ/usr/local/lib/node_modules/npmļ¼‰ļ¼Œčæ™ę ·å°±äøä¼šå‡ŗēŽ°é—®é¢˜äŗ†ć€‚

The same problem occurs when you switch Node 7 ++.
Solution: When you switch Node (version >7), the npm directory (/usr/local/lib/node_modules/npm) is deleted first, so that no problem occurs.

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

Was this page helpful?
0 / 5 - 0 ratings