Hvaandres
Hvaandres

Reputation: 1005

How do I start my React App After I clone it?

I'm currently trying to deploy my app with netlify, but the problem is that I clone my app into my new computer, and now I'm getting some issues.

> [email protected] start /Users/hvaandres/Documents/GitHub/TodoList_React
> npm run build

npm ERR! missing script: build

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/hvaandres/.npm/_logs/2021-03-04T06_19_54_506Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `npm run build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/hvaandres/.npm/_logs/2021-03-04T06_19_54_546Z-debug.log

I ran the following command npm install and I'm still getting the same issue. This is my debug log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'deploy' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predeploy', 'deploy', 'postdeploy' ]
5 info lifecycle [email protected]~predeploy: [email protected]
6 info lifecycle [email protected]~deploy: [email protected]
7 verbose lifecycle [email protected]~deploy: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~deploy: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/hvaandres/Documents/GitHub/TodoList_React/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
9 verbose lifecycle [email protected]~deploy: CWD: /Users/hvaandres/Documents/GitHub/TodoList_React
10 silly lifecycle [email protected]~deploy: Args: [ '-c', 'npm run build && gh-pages -d build' ]
11 silly lifecycle [email protected]~deploy: Returned: code: 1  signal: null
12 info lifecycle [email protected]~deploy: Failed to exec deploy script
13 verbose stack Error: [email protected] deploy: `npm run build && gh-pages -d build`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1048:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/hvaandres/Documents/GitHub/TodoList_React
16 verbose Darwin 19.6.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "deploy"
18 verbose node v14.15.5
19 verbose npm  v6.14.11
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] deploy: `npm run build && gh-pages -d build`
22 error Exit status 1
23 error Failed at the [email protected] deploy script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]



My package.json:


{
  "name": "todolistv2",
  "version": "1.0.0",
  "description": "Todo-List",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "npm run build"
    
  },
  "keywords": [
    "react",
    "todolist_project"
  ],
  "author": "Alan A. Haro",
  "license": "ISC",
  "dependencies": {
    "react-icons": "^3.11.0"
  }
}

If someone can help me, I would really appreciate it. I'm just trying to learn more.

Upvotes: 1

Views: 1610

Answers (2)

Drew Reese
Drew Reese

Reputation: 202706

Your package JSON file appears to be missing both a start and build command. Add them back in. These are the defaults for newly created React apps using create-react-app. You also appear to be missing dependencies, namely react and react-dom.

{
  "name": "todolistv2",
  "version": "1.0.0",
  "description": "Todo-List",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "react-scripts start",
    "build": "react-scripts build"
  },
  "keywords": [
    "react",
    "todolist_project"
  ],
  "author": "Alan A. Haro",
  "license": "ISC",
  "dependencies": {
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-icons": "^3.11.0",
    ... add any other missing dependencies!!
  }
}

Upvotes: 1

Akhil
Akhil

Reputation: 435

Step 1

you need a Node and Npm in your System Click here for installing Node.js and npm

Step 2

delete Package-lock.json file

Step 3

For installing Node Modules :

Run Command npm install

Step 4

Run Command npm start

if not working then try Command

npm run build

or

npm run dev

if Still not working then open package.json file

and check

"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "npm run build" // your script code is "npm run build"
  },

Upvotes: 1

Related Questions