如何修复代码1退出的Metro Bundler进程

mob*_*ing 2 react-native

如何修复代码1退出的Metro Bundler进程如何代码1退出的Metro'Bundler'进程

Error: Metro  'Bundler' process exited with code 1
    at 'ChildProcess' .<anonymous> (C:\@expo\xdl@56.6.0\'src'\Project.ts:1841: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)
 ERR! code     ELIFECYCLE
 ERR! err no 1
 ERR! @ start: `expo start`
 ERR! Exit status 1
 ERR!
 ERR! Failed at the @ start script.
ERR! This is probably not a problem with npm. There is likely additional logging output above.

 ERR! A complete log of this run can be found in:
 ERR!     C:\Users\Pranav\AppData\Roaming\npm-cache\_logs\2019-11-08T04_33_07_234Z-debug.log
Run Code Online (Sandbox Code Playgroud)

Dag*_*Leó 5

如果您在Windows上运行,则可以尝试在github上的该线程中提供的解决方案。

来自github的解决方案似乎有效:

Got this issue today on windows, but don't need to downgrade node, just as discussed on stackoverflow just need to change some hashes on your project:

\node_modules\metro-config\src\defaults\blacklist.js

var sharedBlacklist = [
  /node_modules[/\\]react[/\\]dist[/\\].*/,
  /website\/node_modules\/.*/,
  /heapCapture\/bundle\.js/,
  /.*\/__tests__\/.*/
];
Run Code Online (Sandbox Code Playgroud)

改成:

var sharedBlacklist = [
  /node_modules[\/\\]react[\/\\]dist[\/\\].*/,
  /website\/node_modules\/.*/,
  /heapCapture\/bundle\.js/,
  /.*\/__tests__\/.*/
];
Run Code Online (Sandbox Code Playgroud)

https://github.com/expo/expo-cli/issues/1074