I’m using react and I’m trying to run my app
When I run "npm run start" it shows this error
npm ERR! Missing script: "start"
npm ERR!
npm ERR! Did you mean one of these?
npm ERR! npm star # Mark your favorite packages
npm ERR! npm stars # View packages marked as favorites
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR! npm run
npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersBrugerAppDataLocalnpm-cache_logs2023-03-18T23_55_28_093Z-debug-0.log
In the debug log it shows this:
0 verbose cli C:Program Filesnodejsnode.exe C:UsersBrugerAppDataRoamingnpmnode_modulesnpmbinnpm-cli.js
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:C:UsersBrugerAppDataRoamingnpmnode_modulesnpmnpmrc Completed in 2ms
6 timing config:load:builtin Completed in 2ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 1ms
9 timing config:load:project Completed in 3ms
10 timing config:load:file:C:UsersBruger.npmrc Completed in 1ms
11 timing config:load:user Completed in 1ms
12 timing config:load:file:C:UsersBrugerAppDataRoamingnpmetcnpmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:validate Completed in 0ms
15 timing config:load:credentials Completed in 1ms
16 timing config:load:setEnvs Completed in 1ms
17 timing config:load Completed in 12ms
18 timing npm:load:configload Completed in 12ms
19 timing npm:load:mkdirpcache Completed in 0ms
20 timing npm:load:mkdirplogs Completed in 0ms
21 verbose title npm start
22 verbose argv "start"
23 timing npm:load:setTitle Completed in 0ms
24 timing config:load:flatten Completed in 2ms
25 timing npm:load:display Completed in 4ms
26 verbose logfile logs-max:10 dir:C:UsersBrugerAppDataLocalnpm-cache_logs
27 verbose logfile C:UsersBrugerAppDataLocalnpm-cache_logs2023-03-18T23_55_28_093Z-debug-0.log
28 timing npm:load:logFile Completed in 7ms
29 timing npm:load:timers Completed in 0ms
30 timing npm:load:configScope Completed in 0ms
31 timing npm:load Completed in 24ms
32 silly logfile start cleaning logs, removing 2 files
33 silly logfile done cleaning log files
34 timing command:run-script Completed in 8ms
35 timing command:start Completed in 13ms
36 verbose stack Error: Missing script: "start"
36 verbose stack
36 verbose stack Did you mean one of these?
36 verbose stack npm star # Mark your favorite packages
36 verbose stack npm stars # View packages marked as favorites
36 verbose stack
36 verbose stack To see a list of scripts, run:
36 verbose stack npm run
36 verbose stack at RunScript.run (C:UsersBrugerAppDataRoamingnpmnode_modulesnpmlibcommandsrun-script.js:98:13)
36 verbose stack at async module.exports (C:UsersBrugerAppDataRoamingnpmnode_modulesnpmlibcli.js:78:5)
37 verbose cwd C:UsersBrugerDownloadslandrup-dans-api-main
38 verbose Windows_NT 10.0.19043
39 verbose node v19.8.1
40 verbose npm v8.19.1
41 error Missing script: "start"
41 error
41 error Did you mean one of these?
41 error npm star # Mark your favorite packages
41 error npm stars # View packages marked as favorites
41 error
41 error To see a list of scripts, run:
41 error npm run
42 verbose exit 1
43 timing npm Completed in 51ms
44 verbose code 1
45 error A complete log of this run can be found in:
45 error C:UsersBrugerAppDataLocalnpm-cache_logs2023-03-18T23_55_28_093Z-debug-0.log
2
Answers
This may happen when you run
npm start
in a directory that has apackage.json
file that does not have a script calledstart
in"scripts"
block.Please check that you are in the correct path with:
You are in the correct path, try running
npm run
and see if your scripts are there, you should see something like:If your package.json has something like:
check for typos, and if
"scripts"
is in the root of your package.json, the same level asversion
andname
.If you installed CRA (create-react-app) globally with
npm install -g
, you may need to uninstall it and usenpx
instead. Refer to this issue, or the documentation:I was able to reproduce the error behavior you described by cloning a react repo to my workstation and trying to start it before running
npm install
. You may want to try runningnpm i
in your project directory, and then try runningnpm run start
once more.