NervJS / taro

开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。 https://taro.zone/
https://docs.taro.zone/
Other
35.58k stars 4.8k forks source link

4.x beta 108 启动 h5 dev 模式内存溢出 #15990

Open weizs opened 4 months ago

weizs commented 4 months ago

相关平台

H5

浏览器版本: Chrome 使用框架: React

复现步骤

初始化 beta 版,启动 h5

期望结果

正常启动

实际结果

不能正常启动。报错如下

taro build --type h5 --watch

👽 Taro v4.0.0-beta.108

The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details. plugin 'taro:vite-h5-config' uses deprecated 'enforce' option. Use 'order' option instead. plugin 'taro:vite-h5-config' uses deprecated 'transform' option. Use 'handler' option instead.

<--- Last few GCs --->

[43640:0x7fabe0008000] 38075 ms: Mark-Compact 3978.5 (4138.2) -> 3965.5 (4141.2) MB, 1719.17 / 0.00 ms (average mu = 0.180, current mu = 0.008) allocation failure; scavenge might not succeed [43640:0x7fabe0008000] 41102 ms: Mark-Compact 3981.8 (4141.2) -> 3968.8 (4144.2) MB, 2993.26 / 0.00 ms (average mu = 0.077, current mu = 0.011) allocation failure; scavenge might not succeed

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory ----- Native stack trace -----

1: 0x10ae42c80 node::OOMErrorHandler(char const, v8::OOMDetails const&) [/Users/william/.nvm/versions/node/v20.13.1/bin/node] 2: 0x10aff9adc v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate, char const, v8::OOMDetails const&) [/Users/william/.nvm/versions/node/v20.13.1/bin/node] 3: 0x10b1e9877 v8::internal::Heap::FatalProcessOutOfMemory(char const) [/Users/william/.nvm/versions/node/v20.13.1/bin/node] 4: 0x10b1e80d9 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/william/.nvm/versions/node/v20.13.1/bin/node] 5: 0x10b1dc941 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/william/.nvm/versions/node/v20.13.1/bin/node] 6: 0x10b1dd385 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/william/.nvm/versions/node/v20.13.1/bin/node] 7: 0x10b1bf4e2 v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/Users/william/.nvm/versions/node/v20.13.1/bin/node] 8: 0x10b63cba0 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long, v8::internal::Isolate) [/Users/william/.nvm/versions/node/v20.13.1/bin/node] 9: 0x10ba0e676 Builtins_CEntry_Return1_ArgvOnStack_NoBuiltinExit [/Users/william/.nvm/versions/node/v20.13.1/bin/node]  ELIFECYCLE  Command failed.

Process finished with exit code 134 (interrupted by signal 6:SIGABRT)

环境信息

👽 Taro v4.0.0-beta.108

  Taro CLI 4.0.0-beta.108 environment info:
    System:
      OS: macOS 13.6.7
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 20.13.1 - ~/.nvm/versions/node/v20.13.1/bin/node
      Yarn: 1.22.19 - /usr/local/bin/yarn
      npm: 10.5.2 - ~/.nvm/versions/node/v20.13.1/bin/npm
    npmPackages:
      @tarojs/cli: 4.0.0-beta.108 => 4.0.0-beta.108 
      @tarojs/components: 4.0.0-beta.108 => 4.0.0-beta.108 
      @tarojs/helper: 4.0.0-beta.108 => 4.0.0-beta.108 
      @tarojs/plugin-framework-react: 4.0.0-beta.108 => 4.0.0-beta.108 
      @tarojs/plugin-platform-alipay: 4.0.0-beta.108 => 4.0.0-beta.108 
      @tarojs/plugin-platform-h5: 4.0.0-beta.108 => 4.0.0-beta.108 
      @tarojs/plugin-platform-harmony-hybrid: 4.0.0-beta.108 => 4.0.0-beta.108 
      @tarojs/plugin-platform-jd: 4.0.0-beta.108 => 4.0.0-beta.108 
      @tarojs/plugin-platform-qq: 4.0.0-beta.108 => 4.0.0-beta.108 
      @tarojs/plugin-platform-swan: 4.0.0-beta.108 => 4.0.0-beta.108 
      @tarojs/plugin-platform-tt: 4.0.0-beta.108 => 4.0.0-beta.108 
      @tarojs/plugin-platform-weapp: 4.0.0-beta.108 => 4.0.0-beta.108 
      @tarojs/react: 4.0.0-beta.108 => 4.0.0-beta.108 
      @tarojs/runtime: 4.0.0-beta.108 => 4.0.0-beta.108 
      @tarojs/shared: 4.0.0-beta.108 => 4.0.0-beta.108 
      @tarojs/taro: 4.0.0-beta.108 => 4.0.0-beta.108 
      @tarojs/vite-runner: 4.0.0-beta.108 => 4.0.0-beta.108 
      babel-preset-taro: 4.0.0-beta.108 => 4.0.0-beta.108 
      eslint-config-taro: 4.0.0-beta.108 => 4.0.0-beta.108 
      react: ^18.0.0 => 18.3.1 
weizs commented 4 months ago

发现 3 天前的 commit 已经修复,为什么昨晚发的包还没有 4.x 的最新代码,pipeline 是多泳道的? https://github.com/NervJS/taro/commit/c62deb4847c099a8edb5ad7db5dac7563b1070d3

antyoxydant commented 3 months ago

请问有解决嘛?用4.0.2的包新建项目,yarn dev:h5依旧报错

ZEJIA-LIU commented 3 months ago

请问有解决嘛?用4.0.2的包新建项目,yarn dev:h5依旧报错 请问vite是什么版本呢

wangzhengbo commented 2 months ago

taro 4.0.4, vite 5.4.0还有此问题