REACT没有启动,因为NPM?

时间:2018-03-07 15:15:31

标签: reactjs npm

我厌倦了尝试启动我的React项目,但我有这样的回应:

Could not find a required file.
  Name: index.js
  Searched in: /Users/cabraces/Projects/cesarcabral/portflio/src
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! portflio@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the portflio@0.1.0 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!     /Users/cabraces/.npm/_logs/2018-03-07T15_05_46_191Z-debug.log

如果我打开文件: 2018-03-07T15_05_46_191Z-debug.log

0 info it worked if it ends with ok
1 verbose cli [ '/Users/cabraces/.nvm/versions/node/v8.9.4/bin/node',
1 verbose cli   '/Users/cabraces/.nvm/versions/node/v8.9.4/bin/npm',
1 verbose cli   'start' ]
2 info using npm@5.7.1
3 info using node@v8.9.4
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle portflio@0.1.0~prestart: portflio@0.1.0
6 info lifecycle portflio@0.1.0~start: portflio@0.1.0
7 verbose lifecycle portflio@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle portflio@0.1.0~start: PATH: /Users/cabraces/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/cabraces/Projects/cesarcabral/portflio/node_modules/.bin:/Users/cabraces/.nvm/versions/node/v8.9.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle portflio@0.1.0~start: CWD: /Users/cabraces/Projects/cesarcabral/portflio
10 silly lifecycle portflio@0.1.0~start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle portflio@0.1.0~start: Returned: code: 1  signal: null
12 info lifecycle portflio@0.1.0~start: Failed to exec start script
13 verbose stack Error: portflio@0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/Users/cabraces/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at EventEmitter.emit (events.js:214:7)
13 verbose stack     at ChildProcess.<anonymous> (/Users/cabraces/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at ChildProcess.emit (events.js:214:7)
13 verbose stack     at maybeClose (internal/child_process.js:925:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid portflio@0.1.0
15 verbose cwd /Users/cabraces/Projects/cesarcabral/portflio
16 verbose Darwin 17.4.0
17 verbose argv "/Users/cabraces/.nvm/versions/node/v8.9.4/bin/node" "/Users/cabraces/.nvm/versions/node/v8.9.4/bin/npm" "start"
18 verbose node v8.9.4
19 verbose npm  v5.7.1
20 error code ELIFECYCLE
21 error errno 1
22 error portflio@0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the portflio@0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

我在互联网上发现了许多相关帖子,总是每个人都建议可以是我的 npm版本,目前 npm@5.7.1

所以,我想知道NPM和React的这个问题是否可以解决,而不是降级我的 npm版本?还有其他建议如何解决这个问题?

1 个答案:

答案 0 :(得分:-1)

请查看我的答案here。这可能有帮助

如果您使用的是rxjs和Typescript库,则两者都存在一些兼容性问题,需要按照链接中的说明进行排序。