NPM not working (Cannot find module 'internal/fs' - nodejs)

后端 未结 4 889
名媛妹妹
名媛妹妹 2021-01-12 21:01

NPM error on update. I recently update to Node version 7.x. Now npm is not working.

I am unable to locate the error, it may be due to -
npm ERR! Ca

相关标签:
4条回答
  • 2021-01-12 21:08

    According to this thread, updating npm to version 4 will solve your problem, try:

    npm i -g npm@4
    

    If this doesn't work, try:

    ~/.n/n/versions/node/7.0.0/bin/npm i -g npm@4
    
    0 讨论(0)
  • 2021-01-12 21:10

    delete node_modules directory and then type in your console "npm install". For a reason that I dont know, if you only update npm, it does not fix the error, but re-installing npm everything is gonna be allright.

    0 讨论(0)
  • 2021-01-12 21:19

    For me, if I facing error "cannot find module internal/fs", it would be refer to command path. Better find the command path:

    npm config get prefix
    

    put into system environment path. It is worked for me after facing the error several days.

    0 讨论(0)
  • 2021-01-12 21:21

    You should be able to remove the npm directory (typically /usr/local/lib/node_modules/npm) and then reinstall one of the official node tarballs, which includes npm (you can find the latest from http://nodejs.org/dist/latest-v7.x/).

    Did you upgrade from an older version of node?

    If so, that is probably part of the reason why you are having this issue. Older versions of graceful-fs (a dependency of npm) did things that are no longer available in node v7.

    0 讨论(0)
提交回复
热议问题