Npm install cannot find module 'semver'

后端 未结 26 1324
南方客
南方客 2020-11-29 15:29

I can\'t use npm install using the command prompt in NodeJS. I\'m getting these errors when running npm install:

module.js:339
             


        
相关标签:
26条回答
  • 2020-11-29 15:40

    On Arch Linux what did the trick for me was:

    sudo pacman -Rs npm
    sudo pacman -S npm
    
    0 讨论(0)
  • 2020-11-29 15:41

    I had the same issue but it was caused by a broken package-lock.json file.

    Deleting package-lock.json and running npm install again fixed it for me.

    0 讨论(0)
  • 2020-11-29 15:42

    For Mac users, I tried installing a bunch of new node versions and uninstalling different ones. That didn't fix it. You have to completely wipe out all your installations first. Follow these instructions... How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X).

    Then download the latest version of node.

    0 讨论(0)
  • 2020-11-29 15:43

    On MS Windows, the solution is to remove %APPDATA%\npm and reinstall node

    0 讨论(0)
  • 2020-11-29 15:43

    Actually, it is taking the reference of previously stored modules.

    Solution:Delete the npm-cache/npm folder in the installation directory of nodejs. In windows, it is in C:/User/Username/Appdata/Roaming/npm(or npm_cache). and try to install again.

    Same thing to do in any OS.

    0 讨论(0)
  • 2020-11-29 15:43

    In my case, simply re-running brew install yarn fixed the problem.

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