Skip to content
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

项目启动报错 #2

Open
bytrix opened this issue Aug 9, 2021 · 2 comments
Open

项目启动报错 #2

bytrix opened this issue Aug 9, 2021 · 2 comments

Comments

@bytrix
Copy link

bytrix commented Aug 9, 2021

demo启动时的报错信息

Error: Module parse failed: baseVisitor[type] is not a function
File was processed with these loaders:
 * ../../node_modules/@tarojs/mini-runner/node_modules/babel-loader/lib/index.js
 * ../../node_modules/@tarojs/mini-runner/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
TypeError: baseVisitor[type] is not a function
    at c (:64254/Users/jack/Desktop/git/taro-dynamic-import-weapp/node_modules/acorn-walk/dist/walk.js:29)
    at Object.skipThrough (:64254/Users/jack/Desktop/git/taro-dynamic-import-weapp/node_modules/acorn-walk/dist/walk.js:186)
    at c (:64254/Users/jack/Desktop/git/taro-dynamic-import-weapp/node_modules/acorn-walk/dist/walk.js:29)
    at Object.base.NewExpression.base.CallExpression (:64254/Users/jack/Desktop/git/taro-dynamic-import-weapp/node_modules/acorn-walk/dist/walk.js:389)
    at c (:64254/Users/jack/Desktop/git/taro-dynamic-import-weapp/node_modules/acorn-walk/dist/walk.js:29)
    at Object.skipThrough (:64254/Users/jack/Desktop/git/taro-dynamic-import-weapp/node_modules/acorn-walk/dist/walk.js:186)
    at c (:64254/Users/jack/Desktop/git/taro-dynamic-import-weapp/node_modules/acorn-walk/dist/walk.js:29)
    at Object.base.ReturnStatement.base.YieldExpression.base.AwaitExpression (:64254/Users/jack/Desktop/git/taro-dynamic-import-weapp/node_modules/acorn-walk/dist/walk.js:240)
    at c (:64254/Users/jack/Desktop/git/taro-dynamic-import-weapp/node_modules/acorn-walk/dist/walk.js:29)
    at Object.skipThrough (:64254/Users/jack/Desktop/git/taro-dynamic-import-weapp/node_modules/acorn-walk/dist/walk.js:186)
    at c (:64254/Users/jack/Desktop/git/taro-dynamic-import-weapp/node_modules/acorn-walk/dist/walk.js:29)
    at Object.base.Program.base.BlockStatement (:64254/Users/jack/Desktop/git/taro-dynamic-import-weapp/node_modules/acorn-walk/dist/walk.js:198)
    at c (:64254/Users/jack/Desktop/git/taro-dynamic-import-weapp/node_modules/acorn-walk/dist/walk.js:29)
    at Object.skipThrough (:64254/Users/jack/Desktop/git/taro-dynamic-import-weapp/node_modules/acorn-walk/dist/walk.js:186)
    at c (:64254/Users/jack/Desktop/git/taro-dynamic-import-weapp/node_modules/acorn-walk/dist/walk.js:29)
    at Object.base.Function (:64254/Users/jack/Desktop/git/taro-dynamic-import-weapp/node_modules/acorn-walk/dist/walk.js:296)
    at Object.../../node_modules/@tarojs/mini-runner/node_modules/babel-loader/lib/index.js!./src/pages/dynamic/index.tsx (index.js:12)
    at __webpack_require__ (webpack_bootstrap:79)
    at Module../src/pages/dynamic/index.tsx (._src_pages_dynamic_index.tsx:1)
    at __webpack_require__ (webpack_bootstrap:79)
    at checkDeferredModules (webpack_bootstrap:45)
    at Array.webpackJsonpCallback [as push] (webpack_bootstrap:32)
    at index.js:2
    at require (VM119 WAService.js:2)
    at <anonymous>:60:9
    at doWhenAllScriptLoaded (<anonymous>:95:21)(env: macOS,mp,1.05.2105170; lib: 2.19.1)

点击跳转按钮无法跳转,报错

_tarojs_taro__WEBPACK_IMPORTED_MODULE_1___default.a.navigateTo is not a function
    at TaroElement.onClick (._src_pages_static_index.tsx:15)
    at TaroElement.dispatchEvent (.._src_dom_element.ts:189)
    at dispatch (.._src_dom_event.ts:107)
    at .._src_dom_event.ts:119
    at Object.Xf [as unstable_batchedUpdates] (_Users_jack_Desktop_git_taro-dynamic-import-weapp_node_modules_react-reconciler_cjs_react-reconciler.production.min.js:141)
    at Object.batchedEventUpdates (.._src_dsl_react.ts:127)
    at Ui.eventHandler [as eh] (.._src_dom_event.ts:114)
    at Object.i.safeCallback (VM119 WAService.js:2)
    at VM119 WAService.js:2
    at Sn (VM119 WAService.js:2)(env: macOS,mp,1.05.2105170; lib: 2.19.1)

运行环境

微信开发者工具:Stable 1.05.2105170
基础调试库:2.19.1
Node:v14.16.1

@CoquettishPoppy
Copy link

这个我知道,缺少安装包,"acorn-walk": "^6.0.1",
"eval5": "^1.4.6",

@JiyuShao
Copy link
Owner

本质上是高版本 acorn-walk 遇到 import() 会报错的问题, 临时解决方案为 taro-plugin-dynamic-import-weapp@^0.3.0 中添加了 [email protected] peerDependency, 保证项目的根目录下安装的是 6.2.0 版本即可, 如果不是会有以下错误提示
Snipaste_2021-11-22_15-23-14

相关 Issue
acornjs/acorn-stage3#1 (comment)
https://github.com/kesne/acorn-dynamic-import

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants