'npm start'不再起作用了

时间:2016-11-04 09:35:25

标签: node.js reactjs npm

我的npm开始不再起作用,但我昨天仍然使用它。就我而言,我也没有改变任何事情。我用它来启动我的反应入门套件(facebooks官方入门套件)。它可能是什么?

> apicalltestapp@0.1.0 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! apicalltestapp@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the apicalltestapp@0.1.0 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 npm@3.10.8
3 info using node@v6.7.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle apicalltestapp@0.1.0~prestart: apicalltestapp@0.1.0
6 silly lifecycle apicalltestapp@0.1.0~prestart: no script for prestart, continuing
7 info lifecycle apicalltestapp@0.1.0~start: apicalltestapp@0.1.0
8 verbose lifecycle apicalltestapp@0.1.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle apicalltestapp@0.1.0~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 apicalltestapp@0.1.0~start: CWD: /Users/dswork/Coding/reactcafe
11 silly lifecycle apicalltestapp@0.1.0~start: Args: [ '-c', 'react-scripts start' ]
12 silly lifecycle apicalltestapp@0.1.0~start: Returned: code: 1  signal: null
13 info lifecycle apicalltestapp@0.1.0~start: Failed to exec start script
14 verbose stack Error: apicalltestapp@0.1.0 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 apicalltestapp@0.1.0
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 apicalltestapp@0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the apicalltestapp@0.1.0 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 ]

2 个答案:

答案 0 :(得分:3)

我看到你失去了cross-spawn

  1. 检查您的package.json / npm-shrinkwrap.json是否具有cross-spawn依赖关系。如果还没有,请运行npm i --save cross-spawn
  2. 如果有,请删除文件夹node_modules
  3. 运行npm install
  4. 它会修复。

答案 1 :(得分:0)

如果没有其他帮助,

  1. 在项目文件夹中创建一个名为.env的新文本文件。
  2. 添加 SKIP_PREFLIGHT_CHECK = true

这将简单地忽略该错误,并让您从React开始:)