How to solve npm error “npm ERR! code ELIFECYCLE”

后端 未结 30 2166
死守一世寂寞
死守一世寂寞 2020-11-22 02:33

I\'m trying to learn react, so I have this sample code for the full-stack react voting app, and I am trying to get it to work but after running npm install followed by npm s

相关标签:
30条回答
  • 2020-11-22 02:51

    workaround: Remove the lock file.

    rm .\package-lock.json
    

    source: https://github.com/mapbox/node-pre-gyp/issues/298 (floriantraber)

    0 讨论(0)
  • 2020-11-22 02:51

    Check for port availability as well if you encounter below message :

    Error: listen EACCES 127.0.0.1:8080
    
    at Object._errnoException (util.js:999:13)
    at _exceptionWithHostPort (util.js:1020:20)
    at Server.setupListenHandle [as _listen2] (net.js:1362:19)
    at listenInCluster (net.js:1420:12)
    at GetAddrInfoReqWrap.doListen [as callback] (net.js:1535:7)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:102:10)
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    
    0 讨论(0)
  • 2020-11-22 02:52

    I resolve this error running following code

    npm cache clean
    

    then delete node_modules directory from my project structure manually or with following command

    rm -rf node_modules
    

    After That install dependencies again using

    npm install
    
    0 讨论(0)
  • 2020-11-22 02:53

    Make sure to use the latest npm version while installing packages using npm.

    While installing JavaScript, mention the latest version of NodeJS. For example, while installing JavaScript using devtools, use the below code:

    devtools i --javascript nodejs:10.15.1
    

    This will download and install the mentioned NodeJS version. This worked for me.

    0 讨论(0)
  • 2020-11-22 02:53

    Usually killall node command fixes mine.

    0 讨论(0)
  • 2020-11-22 02:54

    Change access in node_modules directory

    chmod -R a+rwx ./node_modules 
    
    0 讨论(0)
提交回复
热议问题