2016-11-04 76 views
-2

我的npm start不再工作,但我仍然在昨天工作。就我而言,我也沒有改變任何東西。我正在使用它來啓動我的反應入門套件(facebook官方入門套件)。會是什麼呢?'npm start'不起作用

> [email protected] start /Users/.../reactapp 
> react-scripts start 

module.js:457 
    throw err; 
    ^

Error: Cannot find module 'cross-spawn' 
    at Function.Module._resolveFilename (module.js:455:15) 
    at Function.Module._load (module.js:403:25) 
    at Module.require (module.js:483:17) 
    at require (internal/module.js:20:19) 
    at Object.<anonymous> (/Users/reactapp/node_modules/.bin/react-scripts:2:13) 
    at Module._compile (module.js:556:32) 
    at Object.Module._extensions..js (module.js:565:10) 
    at Module.load (module.js:473:32) 
    at tryModuleLoad (module.js:432:12) 
    at Function.Module._load (module.js:424:3) 

npm ERR! Darwin 15.6.0 
npm ERR! argv "/Users/dswork/.nvm/versions/node/v6.7.0/bin/node" "/Users/dswork/.nvm/versions/node/v6.7.0/bin/npm" "start" 
npm ERR! node v6.7.0 
npm ERR! npm v3.10.8 
npm ERR! code ELIFECYCLE 
npm ERR! [email protected] start: `react-scripts start` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] start script 'react-scripts start'. 
npm ERR! Make sure you have the latest version of node.js and npm installed. 
npm ERR! If you do, this is most likely a problem with the apicalltestapp package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  react-scripts start 
npm ERR! You can get information on how to open an issue for this project with: 
npm ERR!  npm bugs apicalltestapp 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR!  npm owner ls apicalltestapp 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  /Users/dswork/Coding/reactcafe/npm-debug.log 

這裏是NPM-的debug.log:

0 info it worked if it ends with ok 
1 verbose cli [ '/Users/dswork/.nvm/versions/node/v6.7.0/bin/node', 
1 verbose cli '/Users/dswork/.nvm/versions/node/v6.7.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 silly lifecycle [email protected]~prestart: no script for prestart, continuing 
7 info lifecycle [email protected]~start: [email protected] 
8 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true 
9 verbose lifecycle [email protected]~start: PATH: /Users/dswork/.nvm/versions/node/v6.7.0/lib/node_modules/npm/bin/node-gyp-bin:/Users/dswork/Coding/reactcafe/node_modules/.bin:/Users/dswork/.nvm/versions/node/v6.7.0/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin 
10 verbose lifecycle [email protected]~start: CWD: /Users/dswork/Coding/reactcafe 
11 silly lifecycle [email protected]~start: Args: [ '-c', 'react-scripts start' ] 
12 silly lifecycle [email protected]~start: Returned: code: 1 signal: null 
13 info lifecycle [email protected]~start: Failed to exec start script 
14 verbose stack Error: [email protected] start: `react-scripts start` 
14 verbose stack Exit status 1 
14 verbose stack  at EventEmitter.<anonymous> (/Users/dswork/.nvm/versions/node/v6.7.0/lib/node_modules/npm/lib/utils/lifecycle.js:255:16) 
14 verbose stack  at emitTwo (events.js:106:13) 
14 verbose stack  at EventEmitter.emit (events.js:191:7) 
14 verbose stack  at ChildProcess.<anonymous> (/Users/dswork/.nvm/versions/node/v6.7.0/lib/node_modules/npm/lib/utils/spawn.js:40:14) 
14 verbose stack  at emitTwo (events.js:106:13) 
14 verbose stack  at ChildProcess.emit (events.js:191:7) 
14 verbose stack  at maybeClose (internal/child_process.js:877:16) 
14 verbose stack  at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) 
15 verbose pkgid [email protected] 
16 verbose cwd /Users/dswork/Coding/reactcafe 
17 error Darwin 15.6.0 
18 error argv "/Users/dswork/.nvm/versions/node/v6.7.0/bin/node" "/Users/dswork/.nvm/versions/node/v6.7.0/bin/npm" "start" 
19 error node v6.7.0 
20 error npm v3.10.8 
21 error code ELIFECYCLE 
22 error [email protected] start: `react-scripts start` 
22 error Exit status 1 
23 error Failed at the [email protected] start script 'react-scripts start'. 
23 error Make sure you have the latest version of node.js and npm installed. 
23 error If you do, this is most likely a problem with the apicalltestapp package, 
23 error not with npm itself. 
23 error Tell the author that this fails on your system: 
23 error  react-scripts start 
23 error You can get information on how to open an issue for this project with: 
23 error  npm bugs apicalltestapp 
23 error Or if that isn't available, you can get their info via: 
23 error  npm owner ls apicalltestapp 
23 error There is likely additional logging output above. 
24 verbose exit [ 1, true ] 
+0

似乎是package.json腳本中的一個問題,你可以發佈package.json –

+1

你嘗試運行'npm我跨spawn'嗎? – ItsGreg

+0

刪除文件夾'node_modules',然後嘗試再次啓動它。有時它會發生以重新啓動。 – Veer

回答

3

當我看到你失去了cross-spawn

  1. 檢查您的package.json/NPM-shrinkwrap.json有cross-spawn依賴。如果你還沒有,然後運行npm i --save cross-spawn
  2. 如果你有,然後刪除文件夾node_modules
  3. 運行npm install

它將修正。