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

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

    I am using react-create-app in Windows 10, on February 2nd, 2019 with latest NodeJS 11.9.0 and npm 6.7.0 (When you install NodeJS, the npm is existing). I think case of node packages are corrupted is rarely, the main cause permission.

    At the beginning, I put project directory at Desktop, it is belong to C:\ driver. I move to another directory of another driver. Therefore, I remove "file permission" concern. Every work well and simple.

    cd /d D:\
    mkdir temp20190202
    npx create-react-app my-app
    cd my-app
    npm start
    

    It is ok, not put project folder in a directory of C:\ (or other driver what contains Windows Operating system).

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

    i tried to solve this problem with this way

    rm -rf node_modules && rm ./package-lock.json && npm install
    

    But for me its not work. I just restart my machine and its working perfectly.
    Am Linux user ,Machine HP.

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

    I was issuing the npm start command with the folder of the project opened at Sublime Text. Closing ST and restarting the server did the work for me.

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

    first i ran:

    npm run clean
    

    (even though it came with errors)

    Then i deleted the node_modules folder and ran

    npm install
    

    This seems to have solved the problem.

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

    Resolved like this:

    # chown -R <user>: node_modules
    
    0 讨论(0)
  • 2020-11-22 02:59

    In my case, I had checked out a different branch with a new library on it. I fixed my issue by only running npm install without doing anything else. I was confused why I was getting ELIFECYCLE error when the port was not being used, but it must have been because I did not have the library installed. So, you might not have to delete node_modules to fix the issue.

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