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

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

    React Application: For me the issue was that after running npm install had some errors.

    I've went with the recommendation npm audit fix. This operation broke my package.json and package-lock.json (changed version of packages and and structure of .json).

    THE FIX WAS:

    • Delete node_modules
    • Run npm install
    • npm start

    Hope this will be helpfull for someone.

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

    I recommend you update your node version to the latest node version recommended by your application or for short update your node version. I encountered this same problem using node version 11.1 but my application was recommending atleast version 10.x.x or 12.x.x I tried all the suggested reply on this thread but non seemed to work for me untill only when i updated my node version to the recommended latest version .i.e. version 12.16.3 then my application ran.

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

    Cleaning Cache and Node_module are not enough. Follow this steps:

    • npm cache clean --force
    • delete node_modules folder
    • delete package-lock.json file
    • npm install

    It works for me like this.

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

    I was getting similar error messages on a 16.04 Ubuntu instance with DigitalOcean while running npm run build on an app made with create-react-app (link). I upgraded the instance from 512MB RAM to 1GB ($5/mo to $10/mo) and then the script was able to run.

    I post this here to point out that you may get this error due to resource limitations, which I didn't really see explained elsewhere on issue pages and SO answers. And nothing I saw in the error logs pointed me in this direction.

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

    Its weird but it works for me

    Go to

    control panel -->System and Security--> System --> Advanced System Security--> Environment Variables

    In Environment Variable popup you will edit the user variable PATH and add "C:\Windows\System32" value as semicolon separated to the existing value.

    Not but not least restart the Machine.

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

    A possibly unexpected cause: you use Create React App with some warnings left unfixed, and the project fails on CI (e.g. GitLab CI/CD):

    Treating warnings as errors because process.env.CI = true.
    [ ... some warnings here ...]
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    

    Solution: fix yo' warnings!

    Alternative: use CI=false npm run build

    See CRA issue #3657

    (Ashamed to admit that it just happened to me; did not see it until a colleague pointed it out. Thanks Pascal!)

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