NPM start does not work.
Node: v12.6.0 npm: 6.10.0
Note : I put the project directory into the Trash, and ran npm start
in there and it worked. Does anyone have any idea why it's working?
What I've tried:
npx create-react-app my-app
cd my-app
npm start
installed the latest version of npm
installed the latest version of node
reinstalled node modules
deleted node and npm and reinstalled
sh: react-scripts: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! new@0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the new@0.1.0 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/work/.npm/_logs/2019-07-09T16_26_11_301Z-debug.log
npm ls react
└── react@16.8.6
{
"name": "new",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-scripts": "3.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Full Error Log
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/Users/work/.nvm/versions/node/v12.6.0/bin/node',
1 verbose cli '/Users/work/.nvm/versions/node/v12.6.0/bin/npm',
1 verbose cli 'start'
1 verbose cli ]
2 info using npm@6.10.0
3 info using node@v12.6.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle new@0.1.0~prestart: new@0.1.0
6 info lifecycle new@0.1.0~start: new@0.1.0
7 verbose lifecycle new@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle new@0.1.0~start: PATH: /Users/work/.nvm/versions/node/v12.6.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/work/Documents/Summer_2019_Study/Node/odin-node/Project2:MiniMessageBoard/frontend/new/new/node_modules/.bin:/usr/local/mysql/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Users/work/.nvm/versions/node/v12.6.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Postgres.app/Contents/Versions/latest/bin
9 verbose lifecycle new@0.1.0~start: CWD: /Users/work/Documents/Summer_2019_Study/Node/odin-node/Project2:MiniMessageBoard/frontend/new/new
10 silly lifecycle new@0.1.0~start: Args: [ '-c', 'react-scripts start' ]
11 info lifecycle new@0.1.0~start: Failed to exec start script
12 verbose stack Error: new@0.1.0 start: `react-scripts start`
12 verbose stack spawn ENOENT
12 verbose stack at ChildProcess.<anonymous> (/Users/work/.nvm/versions/node/v12.6.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack at ChildProcess.emit (events.js:203:13)
12 verbose stack at maybeClose (internal/child_process.js:1021:16)
12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
13 verbose pkgid new@0.1.0
14 verbose cwd /Users/work/Documents/Summer_2019_Study/Node/odin-node/Project2:MiniMessageBoard/frontend/new/new
15 verbose Darwin 17.7.0
16 verbose argv "/Users/work/.nvm/versions/node/v12.6.0/bin/node" "/Users/work/.nvm/versions/node/v12.6.0/bin/npm" "start"
17 verbose node v12.6.0
18 verbose npm v6.10.0
19 error file sh
20 error code ELIFECYCLE
21 error errno ENOENT
22 error syscall spawn
23 error new@0.1.0 start: `react-scripts start`
23 error spawn ENOENT
24 error Failed at the new@0.1.0 start script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]
react-scripts won't install even after trying several times
What can I do now?
I am thinking there is an error with Node. I have both a /usr/local npm file as well as an npm file within nvm folder.
Run these steps in this order
rm -rf node_modules (or if this does not work remove with the force flag rm -rf node_modules -- force
rm ./package-lock.json (or if this does not work try) rm .\\package-lock.json
npm run clean (or if this does not work) npm cache clean (or if this does not work) npm cache clean --force
npm install -g npm@latest
npm uninstall -g create-react-app npm install -g create-react-app
If the create react-app does not work reinstall npm install --save react react-dom react-scripts (and any other dependencies)
Please, try the following inside your terminal:
First remove all node_modules:
rm -fr node_modules/
followed by:
npm install npm@latest -g
npm install -g create-react-app
npm init react-app my-app
This might be because you might have installed create-react-app
globally in the past. Uninstall the earlier create-react-app
with the following command.
sudo npm uninstall -g create-react-app
Remove the already created project directory followed by installation of your my-app
rm -rf my-app
npx create-react-app my-app
Source : https://create-react-app.dev/docs/getting-started/#quick-start
I had same problem like yours. I tried all the answers on this post and none helped me. I had the trouble in the path, it had a non acepted character (double dot in my case ':').
I modified the path and the problem was solved. Maybe for this reason your project runs on trash.
Check your path to ensure that it's right and it doesn't contains a non acepted character. Also to can try to move the project folder to the root of your disk and try starting up from there.
Facing the same issues : Tried in all the way above given. Its not working....
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! munna@0.1.0 start: react-scripts start
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the munna@0.1.0 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! C:\\Users\\Munna Makwana\\AppData\\Roaming\\npm-cache_logs\\2019-11-30T08_47_34_409Z-debug.log The terminal process terminated with exit code: 1
Terminal will be reused by tasks, press any key to close it.
"version": "0.1.0", "private": true, "dependencies": { "react": "^16.12.0", "react-dom": "^16.12.0", "react-scripts": "3.2.0" },
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.