Skip to content

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

Closed

Description

@ralphtheninja

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 ]

Activity

  1. added
    fsIssues and PRs related to file-system APIs and the fs module.
    npmIssues and PRs related to the npm client dependency or the npm registry.
    on Oct 29, 2016
  2. addaleax commented on Oct 29, 2016

    @addaleax
    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?

  3. ralphtheninja commented on Oct 29, 2016

    @ralphtheninja
    Author

    I'm using n to install my node versions

  4. addaleax commented on Oct 29, 2016

    @addaleax
    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?

  5. ralphtheninja commented on Oct 29, 2016

    @ralphtheninja
    Author
  6. ralphtheninja commented on Oct 29, 2016

    @ralphtheninja
    Author

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

  7. ralphtheninja commented on Oct 29, 2016

    @ralphtheninja
    Author

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

  8. hustshawn commented on Jan 6, 2017

    @hustshawn

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

  9. pr-201 commented on Jan 6, 2017

    @pr-201

    helped total reinstall nodeJS.

  10. bollogo commented on Jan 20, 2017

    @bollogo

    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.

  11. AndrewEQ commented on Jan 24, 2017

    @AndrewEQ

    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. :)
  12. rafaellavm commented on Jan 25, 2017

    @rafaellavm

    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

  13. 6 remaining items

  14. wmill commented on Feb 23, 2017

    @wmill

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

  15. Wirone commented on Mar 21, 2017

    @Wirone

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

  16. stsmurf commented on Mar 22, 2017

    @stsmurf

    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.

  17. hanakin commented on Mar 27, 2017

    @hanakin

    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.

  18. kyawthetkt commented on May 3, 2017

    @kyawthetkt

    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!

  19. luochen1990 commented on May 8, 2017

    @luochen1990

    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.

  20. nattyman commented on May 9, 2017

    @nattyman

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

  21. RichardDavid commented on Aug 4, 2017

    @RichardDavid

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

  22. arpho commented on Aug 21, 2017

    @arpho

    same problem,I did like bollogo and it worked

  23. earth-the-home commented on Oct 5, 2017

    @earth-the-home

    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.

  24. arpho commented on Oct 5, 2017

    @arpho
  25. lunow commented on Nov 3, 2017

    @lunow

    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.

  26. OutsourcedGuru commented on Nov 28, 2017

    @OutsourcedGuru

    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.

  27. zhuziyi1989 commented on Mar 28, 2018

    @zhuziyi1989

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    fsIssues and PRs related to file-system APIs and the fs module.npmIssues and PRs related to the npm client dependency or the npm registry.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions