I understand that this problem has happened to many people many times before, but I spent hours yesterday trying to make this work and I can't figure it out for the life of me.
I'm trying to learn React and when I try to use the "npm start" command, it goes like this:
$ npm start
> react-app@0.1.0 start /react-app
> /react-app/node_modules/react-scripts/scripts/start.js
sh: 1: /react-app/node_modules/react-scripts/scripts/start.js: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! react-app@0.1.0 start: `/react-app/node_modules/react-scripts/scripts/start.js`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the react-app@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! /home/sven/.npm/_logs/2020-12-13T06_45_28_430Z-debug.log
Things I have tried:
- Adding execute permissions to the "start" script
- Removing all node modules, reinstalling node, re-creating the project file
- Editing package.json to include the start script
In the tutorial I am using, the guy just enters npm start and it works with no problem. If anything, could someone explain what npm start does in this context? I really have no idea what to do at this point.
This is what my package.json looks like:
{
"name": "react-app",
"version": "0.1.0",
"private": true,
"scripts": {
"start": "/home/sven/react-app/node_modules/react-scripts/scripts/start.js"
},
"dependencies": {
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.1"
}
}
Here is the log file:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using npm@6.14.4
3 info using node@v10.19.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle react-app@0.1.0~prestart: react-app@0.1.0
6 info lifecycle react-app@0.1.0~start: react-app@0.1.0
7 verbose lifecycle react-app@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle react-app@0.1.0~start: PATH: /usr/share/npm/node_modules/npm-lifecycle/node-gyp-bin:/react-app/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle react-app@0.1.0~start: CWD: /react-app
10 silly lifecycle react-app@0.1.0~start: Args: [ '-c',
10 silly lifecycle '/react-app/node_modules/react-scripts/scripts/start.js' ]
11 silly lifecycle react-app@0.1.0~start: Returned: code: 126 signal: null
12 info lifecycle react-app@0.1.0~start: Failed to exec start script
13 verbose stack Error: react-app@0.1.0 start: `/react-app/node_modules/react-scripts/scripts/start.js`
13 verbose stack Exit status 126
13 verbose stack at EventEmitter.<anonymous> (/usr/share/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/share/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid react-app@0.1.0
15 verbose cwd /react-app
16 verbose Linux 5.4.0-58-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
18 verbose node v10.19.0
19 verbose npm v6.14.4
20 error code ELIFECYCLE
21 error errno 126
22 error react-app@0.1.0 start: `/react-app/node_modules/react-scripts/scripts/start.js`
22 error Exit status 126
23 error Failed at the react-app@0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 126, true ]