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

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

提交回复
热议问题