我正在用react构建一个项目(使用create-react-app创建项目),最近在运行时遇到以下错误
海拔开始
错误如下(我使用的是 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
有人能指出我正确的方向吗?
编辑:这是 npm 生成的日志:
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 ]
解构就像你看到错误的部分被添加到版本 6 中的 node.js。react-scripts
似乎依赖于更新的版本,所以更新你的节点版本可能会解决这个问题。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句