我已安装节点8.10并降级到npm 4,因为我的错误消息是npm 5.
*******************************************************************************
ERROR: npm 5 is not supported yet
然后我使用命令降级npm npm install -g npm @ 4。
所以我创建了我的项目
$>npm install -g create-react-native-app
$>create-react-native-app AwesomeProject
$>cd AwesomeProject
$>npm start
然后我有以下错误消息。
> AwesomeProject@0.1.0 start /private/var/root/AwesomeProject
> react-native-scripts start
09:42:16: Unable to start server
See https://git.io/v5vcn for more information, either install watchman or run the following snippet:
sudo sysctl -w kern.maxfiles=5242880
sudo sysctl -w kern.maxfilesperproc=524288
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! AwesomeProject@0.1.0 start: `react-native-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the AwesomeProject@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! /var/root/.npm/_logs/2018-03-23T08_42_16_152Z-debug.log
我看一下日志文件
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm@4.6.1
3 info using node@v8.10.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle AwesomeProject@0.1.0~prestart: AwesomeProject@0.1.0
6 silly lifecycle AwesomeProject@0.1.0~prestart: no script for prestart, continuing
7 info lifecycle AwesomeProject@0.1.0~start: AwesomeProject@0.1.0
8 verbose lifecycle AwesomeProject@0.1.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle AwesomeProject@0.1.0~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/private/var/root/AwesomeProject/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
10 verbose lifecycle AwesomeProject@0.1.0~start: CWD: /private/var/root/AwesomeProject
11 silly lifecycle AwesomeProject@0.1.0~start: Args: [ '-c', 'react-native-scripts start' ]
12 silly lifecycle AwesomeProject@0.1.0~start: Returned: code: 1 signal: null
13 info lifecycle AwesomeProject@0.1.0~start: Failed to exec start script
14 verbose stack Error: AwesomeProject@0.1.0 start: `react-native-scripts start`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:279:16)
14 verbose stack at emitTwo (events.js:126:13)
14 verbose stack at EventEmitter.emit (events.js:214:7)
14 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack at emitTwo (events.js:126:13)
14 verbose stack at ChildProcess.emit (events.js:214:7)
14 verbose stack at maybeClose (internal/child_process.js:925:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
15 verbose pkgid AwesomeProject@0.1.0
16 verbose cwd /private/var/root/AwesomeProject
17 verbose Darwin 17.2.0
18 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
19 verbose node v8.10.0
20 verbose npm v4.6.1
21 error code ELIFECYCLE
22 error errno 1
23 error AwesomeProject@0.1.0 start: `react-native-scripts start`
23 error Exit status 1
24 error Failed at the AwesomeProject@0.1.0 start script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]
有你的想法吗?
最好的关注。
答案 0 :(得分:0)
尝试以下步骤:
npm install -g npm@latest
更新npm,因为有时会出现问题。 rm -rf node_modules
删除现有模块。 npm install
重新安装项目依赖项。