sgouros
sgouros

Reputation: 494

Reactjs: npm start fails

I am building a project with react (used create-react-app to create the project) and have recently encountered the following error when running

npm start

The error is the following (I am using Ubuntu Linux):

> [email protected] start /home/george/code/linguana
> react-scripts start

/home/george/code/linguana/node_modules/react-scripts/scripts/start.js:33
const {
      ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
    at startup (node.js:140:18)
    at node.js:1001:3
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 complete log of this run can be found in:
npm ERR!     /home/george/.npm/_logs/2017-09-05T08_01_42_672Z-debug.log

Could anyone point me to the right direction?

edit: Here's the log that npm produces:

0 info it worked if it ends with ok
1 verbose cli [ '/home/george/.nvm/versions/node/v5.6.0/bin/node',
1 verbose cli   '/home/george/.nvm/versions/node/v5.6.0/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/george/.nvm/versions/node/v5.6.0/lib/node_modules/npm/bin/node-gyp-bin:/home/george/code/linguana/node_modules/.bin:/home/george/.rvm/gems/ruby-2.2.3/bin:/home/george/.rvm/gems/ruby-2.2.3@global/bin:/home/george/.rvm/rubies/ruby-2.2.3/bin:/home/george/.nvm/versions/node/v5.6.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/george/.rvm/bin:/home/george/.rvm/bin
9 verbose lifecycle [email protected]~start: CWD: /home/george/code/linguana
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/george/.nvm/versions/node/v5.6.0/lib/node_modules/npm/lib/utils/lifecycle.js:289:16)
13 verbose stack     at emitTwo (events.js:100:13)
13 verbose stack     at EventEmitter.emit (events.js:185:7)
13 verbose stack     at ChildProcess.<anonymous> (/home/george/.nvm/versions/node/v5.6.0/lib/node_modules/npm/lib/utils/spawn.js:40:14)
13 verbose stack     at emitTwo (events.js:100:13)
13 verbose stack     at ChildProcess.emit (events.js:185:7)
13 verbose stack     at maybeClose (internal/child_process.js:827:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/george/code/linguana
16 verbose Linux 4.2.0-42-generic
17 verbose argv "/home/george/.nvm/versions/node/v5.6.0/bin/node" "/home/george/.nvm/versions/node/v5.6.0/bin/npm" "start"
18 verbose node v5.6.0
19 verbose npm  v5.3.0
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 ]

Upvotes: 1

Views: 512

Answers (1)

Daniel Schmidt
Daniel Schmidt

Reputation: 11921

Deconstruction like the part you see the error in was added to node.js in version 6. react-scripts seems to rely on a newer version, so updating your node version will probably solve this problem.

Upvotes: 3

Related Questions