Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node 7.0.0, MODULE_NOT_FOUND internal/fs during npm install #9355

Closed
ralphtheninja opened this issue Oct 29, 2016 · 31 comments
Closed

node 7.0.0, MODULE_NOT_FOUND internal/fs during npm install #9355

ralphtheninja opened this issue Oct 29, 2016 · 31 comments
Labels
fs Issues and PRs related to the fs subsystem / file system. npm Issues and PRs related to the npm client dependency or the npm registry.

Comments

@ralphtheninja
Copy link
Contributor

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 npm@3.10.8
3 info using node@v7.0.0
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 ]
@addaleax addaleax added fs Issues and PRs related to the fs subsystem / file system. npm Issues and PRs related to the npm client dependency or the npm registry. labels Oct 29, 2016
@addaleax
Copy link
Member

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?

@ralphtheninja
Copy link
Contributor Author

I'm using n to install my node versions

@addaleax
Copy link
Member

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?

@ralphtheninja
Copy link
Contributor Author

Related issue https://gist.github.com/suissa/528c3e9e264f23378c2b0d36571de2dc (Also seem to use n)

@ralphtheninja
Copy link
Contributor Author

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

@gibfahn
Copy link
Member

gibfahn commented Oct 29, 2016

@ralphtheninja
Copy link
Contributor Author

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

@hustshawn
Copy link

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

@pr-201
Copy link

pr-201 commented Jan 6, 2017

helped total reinstall nodeJS.

@bollogo
Copy link

bollogo commented Jan 20, 2017

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.

@AndrewEQ
Copy link

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

@rafaellavm
Copy link

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

@rafaellavm
Copy link

rafaellavm commented Jan 25, 2017

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

@Pierpaolo1992
Copy link

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

@vrusua
Copy link

vrusua commented Feb 11, 2017

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

@ralphtheninja ralphtheninja reopened this Feb 11, 2017
@ralphtheninja
Copy link
Contributor Author

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.

@bnoordhuis
Copy link
Member

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.

@wmill
Copy link

wmill commented Feb 23, 2017

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

@Wirone
Copy link

Wirone commented Mar 21, 2017

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

@stsmurf
Copy link

stsmurf commented Mar 22, 2017

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.

@hanakin
Copy link

hanakin commented Mar 27, 2017

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

npm WARN deprecated graceful-fs@1.2.3: 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.

@kyawthetkt
Copy link

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

@luochen1990
Copy link

luochen1990 commented May 8, 2017

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

@nattyman
Copy link

nattyman commented May 9, 2017

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

@RichardDavid
Copy link

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

@arpho
Copy link

arpho commented Aug 21, 2017

same problem,I did like bollogo and it worked

@earth-the-home
Copy link

earth-the-home commented Oct 5, 2017

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

C:\Program Files\nodejs\node_modules\npm>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.

@arpho
Copy link

arpho commented Oct 5, 2017 via email

@lunow
Copy link

lunow commented Nov 3, 2017

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.

@OutsourcedGuru
Copy link

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.

@zhuziyi1989
Copy link

zhuziyi1989 commented Mar 28, 2018

当切换 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system. npm Issues and PRs related to the npm client dependency or the npm registry.
Projects
None yet
Development

No branches or pull requests