问题描述
我遇到这个问题已经很长时间了,我已经看到很多人在这里问同样的问题,尝试了一切,但还是没用。
我尝试卸载节点expo-cli,删除.expo,关闭所有本地端口,但是它一直显示此错误。这是错误的完整日志: ps。我使用的是Mac,以前安装的是Flutter,不知道这是否会导致任何可能的错误。
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@6.13.4
3 info using node@v12.14.1
4 verbose run-script [ 'prestart','start','poststart' ]
5 info lifecycle @~prestart: @
6 info lifecycle @~start: @
7 verbose lifecycle @~start: unsafe-perm in lifecycle true
8 verbose lifecycle @~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/lucas/Desktop/Coding/ReactNative/Project/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/lucas/Desktop/Flutter/Flutter/bin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/lucas/.npm-global/bin:/Users/lucas/.npm-global/bin
9 verbose lifecycle @~start: CWD: /Users/lucas/Desktop/Coding/ReactNative/Project
10 silly lifecycle @~start: Args: [ '-c','expo start' ]
11 silly lifecycle @~start: Returned: code: 1 signal: null
12 info lifecycle @~start: Failed to exec start script
13 verbose stack Error: @ start: `expo start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:223:5)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:223:5)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid @
15 verbose cwd /Users/lucas/Desktop/Coding/ReactNative/Project
16 verbose Darwin 18.7.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
18 verbose node v12.14.1
19 verbose npm v6.13.4
20 error code ELIFECYCLE
21 error errno 1
22 error @ start: `expo start`
22 error Exit status 1
23 error Failed at the @ start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1,true ]
当我输入本地主机时,它会显示正常的Metro页面,但在约5秒钟后,页面变为黑色,并显示消息连接到Metro bundler失败。。
有人知道如何解决吗?
解决方法
我不知道该线程是否仍处于打开状态,但是我遇到了类似的问题,并且已通过一些简单的步骤解决了该问题:
- 您可以剪切.expo文件并将其粘贴到其他任何虚拟对象中 文件不在应用目录中。
- 然后在重新放置.expo文件夹之后,重新打开终端,然后执行npm start 与以前一样。
正如您在第23行看到的那样,它说npm没问题,所以 卸载并重新安装Nodejs和npm不合逻辑。该行还说,还有其他日志记录输出,主要是指.expo文件。还要检查您的互联网连接是否正常,稳定。当我从移动热点切换到wifi时,它确实对我有用。