Closed limingwei closed 2 years ago
TypeError Cannot read properties of undefined (reading 'isBatchingLegacy') Call Stack ensureRootIsScheduled vendors-node_modules_taro_h5_prebundle_react-dom_js.js:18595:56 scheduleUpdateOnFiber vendors-node_modules_taro_h5_prebundle_react-dom_js.js:18551:25 updateContainer vendors-node_modules_taro_h5_prebundle_react-dom_js.js:20778:25 undefined vendors-node_modules_taro_h5_prebundle_react-dom_js.js:21303:29 flushSync vendors-node_modules_taro_h5_prebundle_react-dom_js.js:18935:36 legacyCreateRootFromDOMContainer vendors-node_modules_taro_h5_prebundle_react-dom_js.js:21302:25 legacyRenderSubtreeIntoContainer vendors-node_modules_taro_h5_prebundle_react-dom_js.js:21323:33 Object.render vendors-node_modules_taro_h5_prebundle_react-dom_js.js:21386:28 renderReactRoot vendors-node_modules_taro_h5_prebundle_chunk-KQAFAKAJ_js.js:284:78 Object.value [as onLaunch] vendors-node_modules_taro_h5_prebundle_chunk-KQAFAKAJ_js.js:351:21
包管理用的 yarn 还是?
npm
+1 用的yarn
使用的是默认模板?
用的mobx
reacrt 18 目前在 taro 的 rn 下还未支持。(需要 0.69 RN版本)
dev:rn 会安装安装 react@17
可先把更新下 react-dom 版本
"react-dom": "^17.0.2",
如下调整了
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-native": "^0.68.3"
dev:h5 build:h5 dev:weapp build:weapp dev:rn 正常 无报错
build:rn 提示
**/Users/lmw/git/ewei-frontend/ewei-frontend-taro/node_modules/metro-hermes-compiler/src/emhermesc.js:77
throw ex;
^
RuntimeError: abort(Error: Unable to resolve module @tarojs/components-rn/dist/components/View from /Users/lmw/git/ewei-frontend/ewei-frontend-taro/src/pages/index/index.tsx: @tarojs/components-rn/dist/components/View could not be found within the project or in these directories:
node_modules
> 1 | import { Component, PropsWithChildren } from 'react'
2 | import { View, Text } from '@tarojs/components'
3 | import './index.less'
4 |). Build with -s ASSERTIONS=1 for more info.
at process.abort (/Users/lmw/git/ewei-frontend/ewei-frontend-taro/node_modules/metro-hermes-compiler/src/emhermesc.js:402:15)
at process.emit (node:events:525:35)
at emit (node:internal/process/promises:149:20)
at processPromiseRejections (node:internal/process/promises:283:27)
at processTicksAndRejections (node:internal/process/task_queues:96:32)**
未复现该问题。
尝试
watchman watch-del-all
yarn build:rn --platform ios --reset-cache
或提供 demo 仓库
npm i @tarojs/components-rn@3.5.5
推荐使用 yarn
现在执行 dev 和 build 都不报错了
但 dev:weapp 后 在小程序开发工具中打开后报错
[system] LazyCodeLoading: false
VM27 WAServiceMainContext.js:1 Uncaught (in promise) undefined(env: macOS,mp,1.06.2208311; lib: 2.26.1)
(anonymous) @ VM27 WAServiceMainContext.js:1
_privEmit @ VM27 WAServiceMainContext.js:1
emit @ VM27 WAServiceMainContext.js:1
Be @ VM27 WAServiceMainContext.js:1
Ve @ VM27 WAServiceMainContext.js:1
(anonymous) @ VM27 WAServiceMainContext.js:1
emit @ VM27 WAServiceMainContext.js:1
c @ VM9 asdebug.js:10
(anonymous) @ instanceframe?s=1663645724380&autoload:19
Promise.then (async)
(anonymous) @ instanceframe?s=1663645724380&autoload:15
VM78:9 app.js错误:
Error: Cannot find module 'react'
at webpackEmptyContext (:25452/appservice/prebundle/node_modules_taro_weapp_prebundle_sync_recursive-_94893.js?t=wechat&s=1663645720989&v=70acca9a8ea6b2f8a47754fc9178903c:10)
at $$$reconciler (:25452/appservice/prebundle/vendors-node_modules_taro_weapp_prebundle_react-dom_js.js?t=wechat&s=1663645720989&v=e7ed1cc1114381009de788abffe91d8a:291)
at Object../node_modules/.taro/weapp/prebundle/react-dom.js (:25452/appservice/prebundle/vendors-node_modules_taro_weapp_prebundle_react-dom_js.js?t=wechat&s=1663645720989&v=e7ed1cc1114381009de788abffe91d8a:5814)
at __webpack_require__ (:25452/appservice/runtime.js:24)
at :25452/appservice/prebundle/remoteEntry.js?t=wechat&s=1663645720989&v=2c22ab35c2fa9d1eb6b64346bc1e6a4f:81
at Object.webpack/container/remote/react-dom (:25452/appservice/runtime.js:257)
at __webpack_require__ (:25452/appservice/runtime.js:24)
at Object../src/app.ts (:25452/appservice/app.js:96)
at __webpack_require__ (:25452/appservice/runtime.js:24)
at __webpack_exec__ (:25452/appservice/app.js:123)(env: macOS,mp,1.06.2208311; lib: 2.26.1)
(anonymous) @ VM78:9
doWhenAllScriptLoaded @ VM55:6713
scriptLoaded @ VM55:6741
(anonymous) @ VM55:6766
Promise.then (async)
(anonymous) @ VM55:6787
(anonymous) @ VM55:6791
loadScripts @ VM17 assubloader.js:1
async function (async)
loadScripts @ VM17 assubloader.js:1
loadAppResourceScripts @ VM17 assubloader.js:1
(anonymous) @ VM47 app-service.js:1
VM27 WAServiceMainContext.js:1 Error: Cannot find module 'react'
at webpackEmptyContext (:25452/appservice/prebundle/node_modules_taro_weapp_prebundle_sync_recursive-_94893.js?t=wechat&s=1663645720989&v=70acca9a8ea6b2f8a47754fc9178903c:10)
at $$$reconciler (:25452/appservice/prebundle/vendors-node_modules_taro_weapp_prebundle_react-dom_js.js?t=wechat&s=1663645720989&v=e7ed1cc1114381009de788abffe91d8a:291)
at Object../node_modules/.taro/weapp/prebundle/react-dom.js (:25452/appservice/prebundle/vendors-node_modules_taro_weapp_prebundle_react-dom_js.js?t=wechat&s=1663645720989&v=e7ed1cc1114381009de788abffe91d8a:5814)
at __webpack_require__ (:25452/appservice/runtime.js:24)
at :25452/appservice/prebundle/remoteEntry.js?t=wechat&s=1663645720989&v=2c22ab35c2fa9d1eb6b64346bc1e6a4f:81
at Object.webpack/container/remote/react-dom (:25452/appservice/runtime.js:257)
at __webpack_require__ (:25452/appservice/runtime.js:24)
at Object../src/app.ts (:25452/appservice/app.js:96)
at __webpack_require__ (:25452/appservice/runtime.js:24)
at __webpack_exec__ (:25452/appservice/app.js:123)(env: macOS,mp,1.06.2208311; lib: 2.26.1)
errorReport @ VM27 WAServiceMainContext.js:1
thirdErrorReport @ VM27 WAServiceMainContext.js:1
(anonymous) @ VM27 WAServiceMainContext.js:1
a @ VM38 WASubContext.js:1
(anonymous) @ VM38 WASubContext.js:1
_privEmit @ VM38 WASubContext.js:1
emit @ VM38 WASubContext.js:1
(anonymous) @ VM38 WASubContext.js:1
Pe @ VM38 WASubContext.js:1
(anonymous) @ VM38 WASubContext.js:1
Pe @ VM38 WASubContext.js:1
onLoad @ VM38 WASubContext.js:1
re @ VM38 WASubContext.js:1
(anonymous) @ VM38 WASubContext.js:1
doWhenAllScriptLoaded @ VM55:6713
scriptLoaded @ VM55:6741
(anonymous) @ VM55:6766
error (async)
(anonymous) @ VM38 WASubContext.js:1
(anonymous) @ VM38 WASubContext.js:1
(anonymous) @ VM38 WASubContext.js:1
(anonymous) @ VM38 WASubContext.js:1
WAServiceMainContext.js?t=wechat&s=1663645720989&v=2.26.1:1 [system] WeChatLib: 2.26.1 (2022.9.19 18:51:41)
WAServiceMainContext.js?t=wechat&s=1663645720989&v=2.26.1:1 [system] Subpackages: N/A
WAServiceMainContext.js?t=wechat&s=1663645720989&v=2.26.1:1 [system] LazyCodeLoading: false
[基础库] 正在使用灰度中的基础库 2.26.1 进行调试。如有问题,请前往工具栏-详情-本地设置更改基础库版本。
VM143:9 app.js错误:
Error: Cannot find module 'react'
at webpackEmptyContext (node_modules_taro_weapp_prebundle_sync_recursive-_94893.js?t=wechat&s=1663645720989&v=70acca9a8ea6b2f8a47754fc9178903c:10)
at $$$reconciler (vendors-node_modules_taro_weapp_prebundle_react-dom_js.js?t=wechat&s=1663645720989&v=e7ed1cc1114381009de788abffe91d8a:291)
at Object../node_modules/.taro/weapp/prebundle/react-dom.js (vendors-node_modules_taro_weapp_prebundle_react-dom_js.js?t=wechat&s=1663645720989&v=e7ed1cc1114381009de788abffe91d8a:5814)
at __webpack_require__ (webpack_bootstrap:19)
at remoteEntry.js?t=wechat&s=1663645720989&v=2c22ab35c2fa9d1eb6b64346bc1e6a4f:81
at Object.webpack/container/remote/react-dom (webpack_runtime_remotes loading:59)
at __webpack_require__ (webpack_bootstrap:19)
at Object../src/app.ts (._src_app.ts:18)
at __webpack_require__ (webpack_bootstrap:19)
at __webpack_exec__ (app.ts?7071:19)(env: macOS,mp,1.06.2208311; lib: 2.26.1)
(anonymous) @ VM143:9
doWhenAllScriptLoaded @ VM120:6713
scriptLoaded @ VM120:6741
(anonymous) @ VM120:6766
Promise.then (async)
(anonymous) @ VM120:6787
(anonymous) @ VM120:6791
loadScripts @ assubloader.js:1
async function (async)
loadScripts @ assubloader.js:1
loadAppResourceScripts @ assubloader.js:1
(anonymous) @ app-service.js:1
WAServiceMainContext.js?t=wechat&s=1663645720989&v=2.26.1:1 Error: Cannot find module 'react'
at webpackEmptyContext (node_modules_taro_weapp_prebundle_sync_recursive-_94893.js?t=wechat&s=1663645720989&v=70acca9a8ea6b2f8a47754fc9178903c:10)
at $$$reconciler (vendors-node_modules_taro_weapp_prebundle_react-dom_js.js?t=wechat&s=1663645720989&v=e7ed1cc1114381009de788abffe91d8a:291)
at Object../node_modules/.taro/weapp/prebundle/react-dom.js (vendors-node_modules_taro_weapp_prebundle_react-dom_js.js?t=wechat&s=1663645720989&v=e7ed1cc1114381009de788abffe91d8a:5814)
at __webpack_require__ (webpack_bootstrap:19)
at remoteEntry.js?t=wechat&s=1663645720989&v=2c22ab35c2fa9d1eb6b64346bc1e6a4f:81
at Object.webpack/container/remote/react-dom (webpack_runtime_remotes loading:59)
at __webpack_require__ (webpack_bootstrap:19)
at Object../src/app.ts (._src_app.ts:18)
at __webpack_require__ (webpack_bootstrap:19)
at __webpack_exec__ (app.ts?7071:19)(env: macOS,mp,1.06.2208311; lib: 2.26.1)
errorReport @ WAServiceMainContext.js?t=wechat&s=1663645720989&v=2.26.1:1
thirdErrorReport @ WAServiceMainContext.js?t=wechat&s=1663645720989&v=2.26.1:1
(anonymous) @ WAServiceMainContext.js?t=wechat&s=1663645720989&v=2.26.1:1
a @ WASubContext.js?t=wechat&s=1663645720989&v=2.26.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1663645720989&v=2.26.1:1
_privEmit @ WASubContext.js?t=wechat&s=1663645720989&v=2.26.1:1
emit @ WASubContext.js?t=wechat&s=1663645720989&v=2.26.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1663645720989&v=2.26.1:1
Pe @ WASubContext.js?t=wechat&s=1663645720989&v=2.26.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1663645720989&v=2.26.1:1
Pe @ WASubContext.js?t=wechat&s=1663645720989&v=2.26.1:1
onLoad @ WASubContext.js?t=wechat&s=1663645720989&v=2.26.1:1
re @ WASubContext.js?t=wechat&s=1663645720989&v=2.26.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1663645720989&v=2.26.1:1
doWhenAllScriptLoaded @ VM120:6713
scriptLoaded @ VM120:6741
(anonymous) @ VM120:6766
error (async)
(anonymous) @ WASubContext.js?t=wechat&s=1663645720989&v=2.26.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1663645720989&v=2.26.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1663645720989&v=2.26.1:1
(anonymous) @ WASubContext.js?t=wechat&s=1663645720989&v=2.26.1:1
WASubContext.js?t=wechat&s=1663645720989&v=2.26.1:1 Page "pages/index/index" has not been registered yet.
WAServiceMainContext.js?t=wechat&s=1663645720989&v=2.26.1:1 [system] Launch Time: 1557 ms
:25452/appservice/instanceframe?s=1663645724380&autoload#id_2:1 Uncaught (in promise) undefined(env: macOS,mp,1.06.2208311; lib: 2.26.1)
worker.js?libName=WAAccelerateWorker.js:1 [Deprecation] SharedArrayBuffer will require cross-origin isolation as of M92, around July 2021. See https://developer.chrome.com/blog/enabling-shared-array-buffer/ for more details.
e.onmessage @ worker.js?libName=WAAccelerateWorker.js:1
worker.js?libName=WAAccelerateWorker.js:1 [worker] reportRealtimeAction:fail not support
e.workerInvokeJsApi @ worker.js?libName=WAAccelerateWorker.js:1
(anonymous) @ WAWorker.js:1
invoke @ WAWorker.js:1
invoke @ WAWorker.js:1
D @ WAWorker.js:1
(anonymous) @ WAWorker.js:1
Ae @ WAWorker.js:1
U @ WAWorker.js:1
p @ WAWorker.js:1
(anonymous) @ WAWorker.js:1
(anonymous) @ WAWorker.js:1
setTimeout (async)
globalThis.setTimeout @ WAWorker.js:1
(anonymous) @ WAWorker.js:1
ye @ WAWorker.js:1
(anonymous) @ WAWorker.js:1
s @ WAWorker.js:1
callAndRemove @ WAWorker.js:1
invokeCallbackHandler @ WAWorker.js:1
eval @ VM10:1
e.onmessage @ worker.js?libName=WAAccelerateWorker.js:1
且 用 Taro Playground 1.0 RN 0.70 Taro 3.5.5 扫描打开后
https://github.com/wuba/taro-playground/releases/tag/v1.6.4
0.70 及 0.69 还未正式发布,请使用 0.68
感谢 RN 已经正常 现在剩余 dev:weapp 报错的问题
rm -rf node_modules
yarn
yarn dev:weapp
好了,感谢 目前看问题都已解决
问题是解决了,但我感觉,事儿还没完吧 参考官网的资料,敲命令,各种默认选项;东西跑不起来,这事儿应该还是得处理吧
欢迎建议或pr
我按照 rm -rf node_modules yarn yarn dev:weapp 处理的,微信小程序里面还是报错。Cannot read property 'isBatchingLegacy' of undefined
"react": "^17.0.0",
"react-dom": "^17.0.0",
"react-redux": "^7.2.6",
"redux": "^4.1.2",
用的mobx
请问解决了吗
参考官网的资料,敲命令,各种默认选项;东西跑不起来,这事儿应该还是得处理吧
在使用的过程中也正在遇到问题,也是这种:模板运行之后出现一些问题
相关平台
React Native
使用框架: React
复现步骤
mac node 18.7 taro init 项目 less ts 空模板 dev:h5 正常 dev:rn 正常 dev:h5 报undefined (reading 'isBatchingLegacy') 还原 package.json 和 lock install --force dev:h5 正常
期望结果
dev:h5 正常 dev:rn 正常 dev:weapp 正常
实际结果
dev:h5 正常 dev:rn 异常 dev:weapp 正常
环境信息