Reputation: 55
I know already there are some questions with similar issues with create-react-app but nothing is helpful. So please go through my issue once before duplicating it.
I am trying to create react application using create-react-app in Windows 10.
Below are the steps I followed in cmd.
C:\Users\jashe\Documents>npm -v
6.12.0
C:\Users\jashe\Documents>node -v
v12.13.0
C:\Users\jashe\Documents>npm install -g create-react-app
C:\Users\jashe\AppData\Roaming\npm\create-react-app -> C:\Users\jashe\AppData\Roaming\npm\node_modules\create-react-app\index.js
+ [email protected]
updated 1 package in 4.653s
C:\Users\jashe\Documents>create-react-app my-app
Creating a new React app in C:\Users\jashe\Documents\my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
> [email protected] postinstall C:\Users\jashe\Documents\my-app\node_modules\babel-runtime\node_modules\core-js
> node postinstall || echo "ignore"
> [email protected] postinstall C:\Users\jashe\Documents\my-app\node_modules\core-js
> node scripts/postinstall || echo "ignore"
+ [email protected]
+ [email protected]
+ [email protected]
added 1467 packages from 685 contributors and audited 904909 packages in 86.745s
found 0 vulnerabilities
At this point it's taking long time like hours. But it was not successful even after that.
I tried using npm cache clean --force
and npx create-react-app my-app
as well. Even it's taking long time.
Even if I stop the process and tried to do npm start
it's throwing below error. It didn't add all the dependencies I think
C:\Users\jashe\IdeaProjects\first-react-app>npm start
npm ERR! missing script: start
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jashe\AppData\Roaming\npm-cache\_logs\2019-10-28T11_46_31_137Z-debug.log
Few months back I used create-react-app, it was working. Not sure why it's causing issue now. Any inputs will be helpful. Thanks in advance.
Below are the logs:
C:\Users\jashe\my-app>type C:\Users\jashe\AppData\Roaming\npm-cache\_logs\2019-10-29T00_42_08_772Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'start'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: missing script: start
4 verbose stack at run (C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:155:19)
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:63:5
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:116:5
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:435:5
4 verbose stack at checkBinReferences_ (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:391:45)
4 verbose stack at final (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:433:3)
4 verbose stack at then (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:161:5)
4 verbose stack at ReadFileContext.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:350:20)
4 verbose stack at ReadFileContext.callback (C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:115:16)
4 verbose stack at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:239:13)
5 verbose cwd C:\Users\jashe\my-app
6 verbose Windows_NT 10.0.18362
7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "start"
8 verbose node v12.13.0
9 verbose npm v6.12.0
10 error missing script: start
11 verbose exit [ 1, true ]
Below is my package.json
{ "name": "my-app", "version": "0.1.0", "private": true, "dependencies": { "react": "16.11.0", "react-dom": "16.11.0", "react-scripts": "3.2.0" } }
Upvotes: 4
Views: 7305
Reputation: 1878
I'd the same problem .
Yarn and npm was installed.
Seems some clash on node modules. So, uninstalled yarn and re-run npx create-react-app <app_name>
works for me.
Upvotes: 0
Reputation: 1
do it via powershell, its working that way but not from command prompt
Upvotes: 0
Reputation: 4481
Delete you package-lock.json
and node_modules
and you don't have to install create-react-app globally. Instead you can use npx create-react-app my-app
to create a react app. If this doesn't help can you please post the log of your 2019-10-28T11_46_31_137Z-debug.log
file?.
Update
your package.json
file should have theses set of lines.
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
}
But the code that you have shared doesn't include them. Try adding these to your package.json
Upvotes: 1