【问题标题】:How to fix Metro Bundler process exited with code 1如何修复 Metro Bundler 进程以代码 1 退出
【发布时间】:2020-03-04 17:47:19
【问题描述】:

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

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

【问题讨论】:

  • 如何解决错误:Metro Bundler 进程以代码 1 退出

标签: react-native expo metro-bundler


【解决方案1】:

看来是nodejs的版本(12.13.1)有问题。它适用于旧版本 12.9.1。

我遇到了类似的问题,所以我卸载了这个版本并安装了旧版本。这解决了 Metro bundler 的问题。

【讨论】:

  • 欢迎来到 Stack Overflow!这与一周前 YAcine Mathurin 发布的答案基本相同。
【解决方案2】:

有同样的问题,并通过将我的 nodejs 版本从 12.13.1 降低到 12.9.1

来解决它

有 github 线程以获取更多详细信息: https://github.com/expo/expo-cli/issues/1074

【讨论】:

  • @Rohan Devaki 卸载您当前的版本,重新启动您的计算机,然后选择nodejs.org/dist 上的那些版本进行安装。我在 Windows 上,所以为了简单起见,我确实使用了扩展 msi 的相应版本。
【解决方案3】:

我通过简单地删除文件夹解决了这个问题: C:\Users\bunty\AppData\Roaming\npm 并删除 npm 文件夹。 并在 cmd(administrator) 中键入命令 npm install -g expo-cli。 如果还是不行,请尝试使用低版本的 node(12.9.0)。

【讨论】:

    【解决方案4】:

    如果您在 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__\/.*/
    ];
    

    改为:

    var sharedBlacklist = [
      /node_modules[\/\\]react[\/\\]dist[\/\\].*/,
      /website\/node_modules\/.*/,
      /heapCapture\/bundle\.js/,
      /.*\/__tests__\/.*/
    ];
    

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

    【讨论】:

    • 不错,谢谢兄弟
    • 非常感谢。为什么这不被接受为答案?
    • 错误仍然发生兄弟error: unknown option --assetExts' Metro Bundler 进程退出,代码为 1`
    猜你喜欢
    • 2019-03-15
    • 2019-03-29
    • 2020-02-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-31
    • 1970-01-01
    相关资源
    最近更新 更多