React Native packager.js 错误导致开发服务器崩溃?

Posted

技术标签:

【中文标题】React Native packager.js 错误导致开发服务器崩溃?【英文标题】:React Native packager.js bug crashes development server? 【发布时间】:2015-12-13 19:13:22 【问题描述】:

似乎为应用程序提供 javascript 的开发服务器已损坏代码(在 Windows 上)。

调用它来运行开发服务器:node node_modules/react-native/packager/packager.js 工作正常,直到应用程序请求 JavaScript Bundle。这会导致开发服务器崩溃:

每次崩溃看起来都略有不同,以下是一些示例:

    <--- Last few GCs --->

      299789 ms: Scavenge 1401.1 (1455.6) -> 1401.1 (1455.6) MB, 7.4 / 0 ms (+ 2.0 ms in 1 steps since last GC) [allocation failure] [incremental marking delaying mark-sweep].
      300662 ms: Mark-sweep 1401.1 (1455.6) -> 1401.0 (1455.6) MB, 872.8 / 1 ms (+ 3.0 ms in 2 steps since start of marking, biggest step 2.0 ms) [last resort gc].
      301517 ms: Mark-sweep 1401.0 (1455.6) -> 1401.0 (1455.6) MB, 855.0 / 0 ms [last resort gc].


    <--- JS stacktrace --->

    ==== JS stack trace =========================================

    Security context: 00000394AB737349 <JS Object>
        1: join [path.js:~217] [pc=000000C79FE49004] (this=000003690CB64909 <an Object with map 000003B796023E19>)
        2: arguments adaptor frame: 3->0
        3: /* anonymous */(aka /* anonymous */) [Y:\Mobile\node_modules\react-native\packager\react-packager\src\DependencyResolver\DependencyGraph\ResolutionRequest.js:~226] [pc=000000C7A12131DA] (this=00000394AB704131 <undefined>,realModuleN...

    FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory

另一个:

    <--- JS stacktrace --->

    ==== JS stack trace =========================================

    Security context: 000000A2FB137349 <JS Object>
        1: split(aka split) [Y:\Mobile\node_modules\react-native\node_modules\babel-core\node_modules\core-js\modules\es6.regexp.split.js:7] [pc=000003ABD89C3ED4] (this=0000033DA680BFD9 <String[33]: \node_modules\regenerator/runtime>,separator=0000033DA680BF91
    <JS RegExp>,limit=000000A2FB104131 <undefined>)
        2: arguments adaptor frame: 1->2
        3: normalize [path.js:193] [pc=000003ABD8...

    FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory

这使得在 Windows 上无法使用 React Native。

请帮忙解决这个问题,谢谢。

【问题讨论】:

【参考方案1】:

看起来有一个修复,在 Github 问题上发表评论:

https://github.com/facebook/react-native/issues/2787

【讨论】:

以上是关于React Native packager.js 错误导致开发服务器崩溃?的主要内容,如果未能解决你的问题,请参考以下文章

添加 React-Native-Camera 和 React-Native-Push-Notification 后无法构建 React Native

react native 增加react-native-camera

更新 react-native-maps 以使用 create-react-native-app

react native 增加react-native-storage

React-Native 和 Expo:create-react-native-app 和 react-native init 之间的区别

什么是 react-native-cli 和 @react-native-community/cli?