Reputation: 73
when running
npm start
I get the following error:
npm ERR! missing script: start
Here is my package.json:
{
"name": "react-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1"
}
}
I am really new to this and I am very lost on what to do, I appreciate any answers. I checked at least 5 previous stack questions about this and I was not able to figure it out. :)
Upvotes: 0
Views: 169
Reputation: 3994
You need to add the start script in your package.json. Since this is a react project, you can use the react-scripts
package to start your app.
{
"name": "react-app",
"version": "0.1.0",
"private": true,
"scripts": {
"start": "react-scripts start"
},
"dependencies": {
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1"
}
}
Upvotes: 1
Reputation: 1059
"scripts": {
"start": "node your-script.js"
}
there is no "scripts" in your package.json. please look at https://docs.npmjs.com/misc/scripts#default-values
change your package.json like this
{
"name": "react-app",
"version": "0.1.0",
"private": true,
"scripts": {
"start": "node your-script.js"
},
"dependencies": {
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1"
}
}
Upvotes: 1
Reputation: 195
You need a script in your package.json
{
"name": "react-app",
"version": "0.1.0",
"private": true,
"scripts": { <-------
"command_name": "command to run such as nodemon app.js
}
"dependencies": {
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1"
}
}
Upvotes: 1