I'm working on a React application. When I'm using the mand npm start
, it gives an error. I tried deleting node_modules and package-lock.json and then doing npm install
. I also tried doing npm cache clean --force
. The last thing I did was npm audit fix
. I still have the same issue. Here is my error:
> [email protected] start /home/serg/webdev/majestic-bay
> react-scripts start
/home/serg/webdev/majestic-bay/node_modules/terser-webpack-plugin/node_modules/p-limit/index.js:30
} catch {}
^
SyntaxError: Unexpected token {
at new Script (vm.js:51:7)
at createScript (vm.js:136:10)
at Object.runInThisContext (vm.js:197:10)
at Module._pile (internal/modules/cjs/loader.js:618:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
at Module.require (internal/modules/cjs/loader.js:598:17)
at require (internal/modules/cjs/helpers.js:11:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A plete log of this run can be found in:
npm ERR! /home/serg/.npm/_logs/2020-11-06T06_52_29_568Z-debug.log
Here is my package.json:
{
"name": "majestic-bay",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.0",
"web-vitals": "^0.2.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Here is the content of the error file:
0 info it worked if it ends with ok
1 verbose cli [ '/home/serg/.nvm/versions/node/v9.11.2/bin/node',
1 verbose cli '/home/serg/.nvm/versions/node/v9.11.2/bin/npm',
1 verbose cli 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: /home/serg/.nvm/versions/node/v9.11.2/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/serg/webdev/majestic-bay/node_modules/.bin:/home/serg/.nvm/versions/node/v9.11.2/bin:/home/serg/.local/bin:/home/serg/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/cxoffice/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin:/opt/cxoffice/bin:/home/serg/.yarn/bin:/home/serg/.yarn/bin
9 verbose lifecycle [email protected]~start: CWD: /home/serg/webdev/majestic-bay
10 silly lifecycle [email protected]~start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle [email protected]~start: Returned: code: 1 signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/home/serg/.nvm/versions/node/v9.11.2/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:180:13)
13 verbose stack at ChildProcess.<anonymous> (/home/serg/.nvm/versions/node/v9.11.2/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:180:13)
13 verbose stack at maybeClose (internal/child_process.js:936:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/serg/webdev/majestic-bay
16 verbose Linux 5.8.18-1-MANJARO
17 verbose argv "/home/serg/.nvm/versions/node/v9.11.2/bin/node" "/home/serg/.nvm/versions/node/v9.11.2/bin/npm" "start"
18 verbose node v9.11.2
19 verbose npm v6.14.8
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: `react-scripts start`
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
I'm working on a React application. When I'm using the mand npm start
, it gives an error. I tried deleting node_modules and package-lock.json and then doing npm install
. I also tried doing npm cache clean --force
. The last thing I did was npm audit fix
. I still have the same issue. Here is my error:
> [email protected] start /home/serg/webdev/majestic-bay
> react-scripts start
/home/serg/webdev/majestic-bay/node_modules/terser-webpack-plugin/node_modules/p-limit/index.js:30
} catch {}
^
SyntaxError: Unexpected token {
at new Script (vm.js:51:7)
at createScript (vm.js:136:10)
at Object.runInThisContext (vm.js:197:10)
at Module._pile (internal/modules/cjs/loader.js:618:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
at Module.require (internal/modules/cjs/loader.js:598:17)
at require (internal/modules/cjs/helpers.js:11:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A plete log of this run can be found in:
npm ERR! /home/serg/.npm/_logs/2020-11-06T06_52_29_568Z-debug.log
Here is my package.json:
{
"name": "majestic-bay",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.0",
"web-vitals": "^0.2.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Here is the content of the error file:
0 info it worked if it ends with ok
1 verbose cli [ '/home/serg/.nvm/versions/node/v9.11.2/bin/node',
1 verbose cli '/home/serg/.nvm/versions/node/v9.11.2/bin/npm',
1 verbose cli 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: /home/serg/.nvm/versions/node/v9.11.2/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/serg/webdev/majestic-bay/node_modules/.bin:/home/serg/.nvm/versions/node/v9.11.2/bin:/home/serg/.local/bin:/home/serg/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/cxoffice/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin:/opt/cxoffice/bin:/home/serg/.yarn/bin:/home/serg/.yarn/bin
9 verbose lifecycle [email protected]~start: CWD: /home/serg/webdev/majestic-bay
10 silly lifecycle [email protected]~start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle [email protected]~start: Returned: code: 1 signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/home/serg/.nvm/versions/node/v9.11.2/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:180:13)
13 verbose stack at ChildProcess.<anonymous> (/home/serg/.nvm/versions/node/v9.11.2/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:180:13)
13 verbose stack at maybeClose (internal/child_process.js:936:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/serg/webdev/majestic-bay
16 verbose Linux 5.8.18-1-MANJARO
17 verbose argv "/home/serg/.nvm/versions/node/v9.11.2/bin/node" "/home/serg/.nvm/versions/node/v9.11.2/bin/npm" "start"
18 verbose node v9.11.2
19 verbose npm v6.14.8
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: `react-scripts start`
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Share
Improve this question
asked Nov 6, 2020 at 7:37
in43shin43sh
9232 gold badges14 silver badges37 bronze badges
8
- Delete the node module and run npm install again – Sohail Ashraf Commented Nov 6, 2020 at 7:44
- @tadman yes, but I don't have it in package.json file. How do I update it then? – in43sh Commented Nov 6, 2020 at 7:44
- @SohailAshraf I tried it many times. It's not the issue for sure. – in43sh Commented Nov 6, 2020 at 7:45
-
terser-webpack-plugin
seems to have a bad dependency, so remove it and re-add it to get the latest version, or use an update checking package. If this is a bad version you may need to force downgrade to a specific working version, plus file a bug report if you can. – tadman Commented Nov 6, 2020 at 7:45 - @tadman ok but how do I remove it if I don't have it in the package.json? – in43sh Commented Nov 6, 2020 at 7:54
1 Answer
Reset to default 15So, it was the node version. I had v9.11.2, so when I installed version v12.19.0, it fixed it.