进入设备面板的时候提示babel/runtime报错

App开发相关产品技术讨论,包括OEM App、App SDK等话题


Post Reply
15919961853
Posts: 14

cnpm install && npm run start 项目可以正常启动;
凃鸦RN中点击面板报以下错误(node_modules目录下面存在babel-runtime):

Loading dependency graph, done.
error: bundling failed: Error: Unable to resolve module @babel/runtime/helpers/interopRequireDefault from /Users/belon/TuYaMiniProject/tuya-panel-demo/examples/curtainSwitch/index.android.js: Module @babel/runtime/helpers/interopRequireDefault does not exist in the Haste module map

This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:

  1. Clear watchman watches: watchman watch-del-all.
  2. Delete the node_modules folder: rm -rf node_modules && npm install.
  3. Reset Metro Bundler cache: rm -rf /tmp/metro-bundler-cache-* or npm start -- --reset-cache.
  4. Remove haste cache: rm -rf /tmp/haste-map-react-native-packager-*.
    at ModuleResolver.resolveDependency (/Users/belon/TuYaMiniProject/tuya-panel-demo/examples/curtainSwitch/node_modules/.store/metro@0.51.1/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:183:15)
    at ResolutionRequest.resolveDependency (/Users/belon/TuYaMiniProject/tuya-panel-demo/examples/curtainSwitch/node_modules/.store/metro@0.51.1/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)
    at DependencyGraph.resolveDependency (/Users/belon/TuYaMiniProject/tuya-panel-demo/examples/curtainSwitch/node_modules/.store/metro@0.51.1/node_modules/metro/src/node-haste/DependencyGraph.js:283:16)
    at Object.resolve (/Users/belon/TuYaMiniProject/tuya-panel-demo/examples/curtainSwitch/node_modules/.store/metro@0.51.1/node_modules/metro/src/lib/transformHelpers.js:261:42)
    at /Users/belon/TuYaMiniProject/tuya-panel-demo/examples/curtainSwitch/node_modules/.store/metro@0.51.1/node_modules/metro/src/DeltaBundler/traverseDependencies.js:399:31
    at Array.map (<anonymous>)
    at resolveDependencies (/Users/belon/TuYaMiniProject/tuya-panel-demo/examples/curtainSwitch/node_modules/.store/metro@0.51.1/node_modules/metro/src/DeltaBundler/traverseDependencies.js:396:18)
    at /Users/belon/TuYaMiniProject/tuya-panel-demo/examples/curtainSwitch/node_modules/.store/metro@0.51.1/node_modules/metro/src/DeltaBundler/traverseDependencies.js:269:33
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Users/belon/TuYaMiniProject/tuya-panel-demo/examples/curtainSwitch/node_modules/.store/metro@0.51.1/node_modules/metro/src/DeltaBundler/traverseDependencies.js:87:24)
    BUNDLE [android, dev] ./index.android.js ░░░░░░░░░░░░░░░░ 0.0% (0/1)::ffff:192.168.3.53 - - [20/Feb/2024:11:19:59 +0000] "GET /index.android.bundle?platform=android&dev=true&minify=false HTTP/1.1" 500 - "-" "okhttp/3.14.9"
    BUNDLE [android, dev] ./index.android.js ░░░░░░░░░░░░░░░░ 0.0% (0/1), failed.

Tags:
lshinylee
Posts: 298

Re: 进入设备面板的时候提示babel/runtime报错

可以尝试通过 yarn 安装,然后 yarn start 尝试一下,看起来也有点像是通过 npm 安装,三方依赖升级导致的问题

:D :D :D

Post Reply