-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
按照文档教程跑demo都报错 #16738
Comments
执行后yarn add metro-react-native-babel-preset |
TheKonka
added
F-react
Framework - React
T-rn
Target - 编译到 React Native
V-4
Version - 4.x
labels
Oct 25, 2024
我在使用基础项目的时候也有问题 一直无法推进。 官方人员请联合查看 #16739 |
This was referenced Oct 26, 2024
我的也是,刚接触,直接按照文档做,一样的问题 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
相关平台
React Native
使用框架: React
复现步骤
yarn global add @tarojs/cli
select react
select typescript
select 预处理器无
select 默认模板
taro init myApp
cd myApp
yarn
yarn dev:run
访问:http://127.0.0.1:8081/index.bundle?platform=ios&dev=true
期望结果
正常运行
实际结果
{
"type": "TransformError",
"lineNumber": 0,
"errors": [
{
"description": "index.js: [BABEL] E:\Job\taro\base-taro-app\index.js: Cannot find module 'metro-react-native-babel-preset'\nRequire stack:\n- E:\Job\taro\base-taro-app\node_modules\@rnx-kit\babel-preset-metro-react-native\src\index.js\n- E:\Job\taro\base-taro-app\node_modules\babel-preset-taro\rn\index.js\n- E:\Job\taro\base-taro-app\node_modules\babel-preset-taro\index.js\n- E:\Job\taro\base-taro-app\node_modules\@babel\core\lib\config\files\module-types.js\n- E:\Job\taro\base-taro-app\node_modules\@babel\core\lib\config\files\configuration.js\n- E:\Job\taro\base-taro-app\node_modules\@babel\core\lib\config\files\index.js\n- E:\Job\taro\base-taro-app\node_modules\@babel\core\lib\index.js\n- E:\Job\taro\base-taro-app\node_modules\metro-transform-worker\src\index.js\n- E:\Job\taro\base-taro-app\node_modules\metro\src\DeltaBundler\Worker.flow.js\n- E:\Job\taro\base-taro-app\node_modules\metro\src\DeltaBundler\Worker.js\n- E:\Job\taro\base-taro-app\node_modules\jest-worker\build\workers\processChild.js (While processing: "E:\\Job\\taro\\base-taro-app\\node_modules\\babel-preset-taro\\index.js")",
"lineNumber": 0
}
],
"name": "SyntaxError",
"message": "index.js: [BABEL] E:\Job\taro\base-taro-app\index.js: Cannot find module 'metro-react-native-babel-preset'\nRequire stack:\n- E:\Job\taro\base-taro-app\node_modules\@rnx-kit\babel-preset-metro-react-native\src\index.js\n- E:\Job\taro\base-taro-app\node_modules\babel-preset-taro\rn\index.js\n- E:\Job\taro\base-taro-app\node_modules\babel-preset-taro\index.js\n- E:\Job\taro\base-taro-app\node_modules\@babel\core\lib\config\files\module-types.js\n- E:\Job\taro\base-taro-app\node_modules\@babel\core\lib\config\files\configuration.js\n- E:\Job\taro\base-taro-app\node_modules\@babel\core\lib\config\files\index.js\n- E:\Job\taro\base-taro-app\node_modules\@babel\core\lib\index.js\n- E:\Job\taro\base-taro-app\node_modules\metro-transform-worker\src\index.js\n- E:\Job\taro\base-taro-app\node_modules\metro\src\DeltaBundler\Worker.flow.js\n- E:\Job\taro\base-taro-app\node_modules\metro\src\DeltaBundler\Worker.js\n- E:\Job\taro\base-taro-app\node_modules\jest-worker\build\workers\processChild.js (While processing: "E:\\Job\\taro\\base-taro-app\\node_modules\\babel-preset-taro\\index.js")",
"stack": "Error: [BABEL] E:\Job\taro\base-taro-app\index.js: Cannot find module 'metro-react-native-babel-preset'\nRequire stack:\n- E:\Job\taro\base-taro-app\node_modules\@rnx-kit\babel-preset-metro-react-native\src\index.js\n- E:\Job\taro\base-taro-app\node_modules\babel-preset-taro\rn\index.js\n- E:\Job\taro\base-taro-app\node_modules\babel-preset-taro\index.js\n- E:\Job\taro\base-taro-app\node_modules\@babel\core\lib\config\files\module-types.js\n- E:\Job\taro\base-taro-app\node_modules\@babel\core\lib\config\files\configuration.js\n- E:\Job\taro\base-taro-app\node_modules\@babel\core\lib\config\files\index.js\n- E:\Job\taro\base-taro-app\node_modules\@babel\core\lib\index.js\n- E:\Job\taro\base-taro-app\node_modules\metro-transform-worker\src\index.js\n- E:\Job\taro\base-taro-app\node_modules\metro\src\DeltaBundler\Worker.flow.js\n- E:\Job\taro\base-taro-app\node_modules\metro\src\DeltaBundler\Worker.js\n- E:\Job\taro\base-taro-app\node_modules\jest-worker\build\workers\processChild.js (While processing: "E:\\Job\\taro\\base-taro-app\\node_modules\\babel-preset-taro\\index.js")\n at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1134:15)\n at Function.resolve (node:internal/modules/helpers:188:19)\n at loadPreset (E:\Job\taro\base-taro-app\node_modules\@rnx-kit\babel-preset-metro-react-native\src\index.js:144:17)\n at module.exports (E:\Job\taro\base-taro-app\node_modules\@rnx-kit\babel-preset-metro-react-native\src\index.js:228:36)\n at module.exports (E:\Job\taro\base-taro-app\node_modules\babel-preset-taro\rn\index.js:23:16)\n at apply (E:\Job\taro\base-taro-app\node_modules\babel-preset-taro\index.js:26:12)\n at sync (E:\Job\taro\base-taro-app\node_modules\@babel\core\src\gensync-utils\async.ts:31:25)\n at sync (E:\Job\taro\base-taro-app\node_modules\gensync\index.js:182:19)\n at factory (E:\Job\taro\base-taro-app\node_modules\gensync\index.js:210:24)\n at Generator.next ()\n at E:\Job\taro\base-taro-app\node_modules\@babel\core\src\config\full.ts:271:23\n at Generator.next ()\n at Function. (E:\Job\taro\base-taro-app\node_modules\@babel\core\src\gensync-utils\async.ts:10:3)\n at Generator.next ()\n at evaluateSync (E:\Job\taro\base-taro-app\node_modules\gensync\index.js:251:28)\n at Function.sync (E:\Job\taro\base-taro-app\node_modules\gensync\index.js:89:14)\n at sync (E:\Job\taro\base-taro-app\node_modules\@babel\core\src\gensync-utils\async.ts:83:25)\n at sync (E:\Job\taro\base-taro-app\node_modules\gensync\index.js:182:19)\n at onFirstPause (E:\Job\taro\base-taro-app\node_modules\gensync\index.js:210:24)\n at Generator.next ()\n at presetDescriptorLoader (E:\Job\taro\base-taro-app\node_modules\@babel\core\src\config\caching.ts:131:34)\n at cachedFunction.next ()\n at loadPresetDescriptor (E:\Job\taro\base-taro-app\node_modules\@babel\core\src\config\full.ts:482:12)\n at loadPresetDescriptor.next ()\n at fn (E:\Job\taro\base-taro-app\node_modules\@babel\core\src\config\full.ts:119:33)\n at recursePresetDescriptors.next ()\n at E:\Job\taro\base-taro-app\node_modules\@babel\core\src\config\full.ts:224:21\n at Generator.next ()\n at loadFullConfig (E:\Job\taro\base-taro-app\node_modules\@babel\core\src\config\full.ts:167:4)\n at loadFullConfig.next ()\n at parse (E:\Job\taro\base-taro-app\node_modules\@babel\core\src\parse.ts:29:35)\n at parse.next ()\n at evaluateSync (E:\Job\taro\base-taro-app\node_modules\gensync\index.js:251:28)\n at fn (E:\Job\taro\base-taro-app\node_modules\gensync\index.js:89:14)\n at stopHiding - secret - don't use this - v1 (E:\Job\taro\base-taro-app\node_modules\@babel\core\src\errors\rewrite-stack-trace.ts:99:14)\n at parseSync (E:\Job\taro\base-taro-app\node_modules\@babel\core\src\parse.ts:65:48)\n at Object.transform [as nextTransformer] (E:\Job\taro\base-taro-app\node_modules\@react-native\metro-babel-transformer\src\index.js:209:11)\n at Object.transform (E:\Job\taro\base-taro-app\node_modules\@tarojs\rn-transformer\src\index.ts:44:18)\n at E:\Job\taro\base-taro-app\node_modules\@tarojs\rn-supporter\src\taroTransformer.ts:60:51\n at Generator.next ()\n at fulfilled (E:\Job\taro\base-taro-app\node_modules\@tarojs\rn-supporter\dist\taroTransformer.js:5:58)"
}
环境信息
The text was updated successfully, but these errors were encountered: