Starting React App from pulled github project

前端 未结 2 1753
有刺的猬
有刺的猬 2021-02-06 07:12

I\'ve pulled a github repository containing code for a reactjs app into one of my directories but I can\'t find a way to run the app on my computer. I can start a new app using

相关标签:
2条回答
  • 2021-02-06 07:29

    Carry out the following steps:

    //Step 1:
    git clone [repository url]
    
    //Step 2:
    cd [local repository]
    
    //Step 3:
    //Check package.json file and ensure scripts are notated as below:
    
    "scripts": {
        "start": "react-scripts start",
        "build": "react-scripts build",
        "test": "react-scripts test",
        "eject": "react-scripts eject"
      },
    
    //Step 4: 
    /* Delete the node_modules folder and any 'lock' files such as 
    yarn.lock or package-lock.json if present.*/
    
    //Step 5: 
    npm install
    
    //Step 6:
    npm start
    

    To Note: There can be some conflict between yarn and npm when cloning from certain repositories. It's best to assume that every repo may need trimming before ultimately running npm install. I tested the above steps several times under several different factors. This is the best I have so far.

    0 讨论(0)
  • 2021-02-06 07:52

    In case of issues shown after npm install, run the below to automatically fix the issues:

    npm audit fix
    

    Alternatively, use the below to see the errors:

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