2017-09-05 212 views
0

我建立與反應項目(用於創建反應的應用程序內創建項目),最近遇到了以下錯誤運行Reactjs:NPM啓動失敗

當NPM啓動

錯誤如下(我正在使用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 

任何人都可以指向正確的方向嗎?

編輯:下面是新公共管理產生的日誌:

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/[email protected]/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 ] 
+0

[Here](https://github.com/facebookincubator/create-react-app#installation)你可以看到'create-react-app'的要求 – bennygenel

回答

2

解構像你看到在加入的node.js版本6 react-scripts錯誤的部分,似乎依賴於較新的版本,所以更新你的節點版本可能會解決這個問題。