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

后端 未结 30 2406
死守一世寂寞
死守一世寂寞 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:34

    The port is probably being used by another application, try listing and see if it's your application:

    lsof -i:8080

    You can kill the process of this port:

    lsof -ti:8080 | xargs kill

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

    Step 1: $ npm cache clean --force

    Step 2: Delete node_modules by $ rm -rf node_modules package-lock.json folder or delete it manually by going into the directory and right-click > delete / move to trash. Also, delete package-lock.json file too.

    Step 3: npm install

    To start again, $ npm start

    This worked for me. Hopes it works for you too.

    PS: Still if it is there, kindly check the error it is displaying in red and act accordingly. This error is specific to node.js environment. Happy Coding!!

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

    Delete node_modules and package-lock.json, and then run npm install. It worked perfectly here(run command below inside project root):

    rm -rf node_modules && rm ./package-lock.json && npm install
    
    0 讨论(0)
  • 2020-11-22 02:36

    Try to reinstall the cli package globally. In my case, I was trying to test a Vue.js tutorial when I get the same error message. The other thing I did was run the vue command again but this time using webpack-simple and that is why I am not sure wich one solved the problem but now it is working.

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

    This solution fixed the error in Win10.

    Please install globally npm install -g node-pre-gyp

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

    My solution:

    I was missing config.env properties because I was developing on a new machine, and of course I keep my config files out of my repo.

    If you are using a different machine than usual, make sure that you include any config files that are not present in the repo that gets cloned.

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