Npm install cannot find module 'semver'

后端 未结 26 1475
南方客
南方客 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:48

    I had the same issue installing on AWS Linux. I had to install it with sudo. So to get around this I followed step 3 from this article (making sure to get the latest version of node)

    https://www.hostingadvice.com/how-to/update-node-js-latest-version/

    wget https://nodejs.org/dist/vx.x.x/node-vx.x.x-linux-x64.tar.xz
    tar -C /home/aUser/node --strip-components 1 -xJf node-vx.x.x-linux.x64.tar.xz
    

    But installed it to the user's home directory /home/aUser/node. Then added that path to my PATH.

    export PATH=/home/aUser/node/bin:$PATH

    After that I was able to do an npm install with no issues.

提交回复
热议问题