Npm install cannot find module 'semver'

后端 未结 26 1327
南方客
南方客 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 16:05

    This worked for me on Ubuntu (latest version dated Oct/2020)

    I had to first get code from the bash source:

    curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
    

    This got the latest version of node which updated my libraries and got rid of the 'semver' error.

    0 讨论(0)
  • 2020-11-29 16:07

    I finally figured this out! Yes, you have to uninstall/delete all files and reinstall. BUT SOME OF THE FILE PATHS ARE TOO LONG TO DELETE DURING THE UNINSTALL PROCESS. The file paths are so long in Node that they may not be able to be deleted. You have to rename the file paths.

    After uninstalling Node, use Command Prompt, navigate to ...\Appdata\roaming\ (use the path from the error message). Try to delete the folder with del npm. Then, if it doesn't allow you to delete a folder, start renaming the folders in the file path in the next error message to "a" or something short. You may have to do this for multiple folders along the path. Then you should be able to delete! Then reinstall node and it should work.

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