Expo在启动后崩溃
使用expo start
启动我的React Native项目时遇到问题。浏览器打开并显示以下页面:
大约一秒钟后,页面完全变暗,并且控制台中出现以下错误(设置了EXPO_DEBUG=true
:]
Expo DevTools is running at http://localhost:19002
Opening DevTools in the browser... (press shift-d to disable)
error Invalid regular expression: /(.*\\__fixtures__\\.*|node_modules[\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/: Unterminated character class. Run CLI with --verbose flag for more details.
Metro Bundler process exited with code 1
Error: Metro Bundler process exited with code 1
at ChildProcess.<anonymous> (C:\@expo\[email protected]\src\Project.ts:1804:16)
at Object.onceWrapper (events.js:300:26)
at ChildProcess.emit (events.js:210:5)
at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
error Command failed with exit code 1.
info Visit for documentation about this command.
我正在运行Windows 10 1903 x64,NodeJs v12.11.0和以下依赖项:
"dependencies": {
"expo": "^35.0.0",
"react": "16.8.3",
"react-dom": "16.8.3",
"react-native": ".0.0.tar.gz",
"react-native-web": "^0.11.7"
},
"devDependencies": {
"@types/react": "^16.8.23",
"@types/react-native": "^0.57.65",
"babel-preset-expo": "^7.0.0",
"typescript": "^3.4.5"
}
知道要怎么办吗?
回答如下:我正在运行Windows 10的Node LTS v10.16.3版本,并且运行良好。我将其更改为Node Current Version v12.11.0,但遇到了相同的错误。恢复到Node LTS版本v10.16.3,并且一切正常。
我还将Expo cli的版本从3.1.2升级了。至3.2.3。以防万一我又恢复到较早的版本(已满12天)npm -g i [email protected]。
如果更改Node版本无效,您也可以尝试一下。
经过上述更改之后,一切再次恢复正常。