进入设备面板的时候提示babel/runtime报错
Posted: 2024年 Feb 20日 19:25
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:
- Clear watchman watches:
watchman watch-del-all
. - Delete the
node_modules
folder:rm -rf node_modules && npm install
. - Reset Metro Bundler cache:
rm -rf /tmp/metro-bundler-cache-*
ornpm start -- --reset-cache
. - 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.