NervJS / taro-antd-mobile

Taro 兼容 Ant Design Mobile
67 stars 14 forks source link

此示例项目运行`yarn dev:h5`失败 #3

Closed liudonghua123 closed 3 years ago

liudonghua123 commented 3 years ago
  1. git clone https://github.com/NervJS/taro-antd-mobile
  2. cd taro-antd-mobile
  3. npm i @tarojs/cli@next -g
  4. yarn
  5. yarn dev:h5
(common) D:\code\weixin\taro-antd-mobile>yarn dev:h5
yarn run v1.22.10
$ npm run build:h5 -- --watch

> taro-antd@1.0.0 build:h5
> taro build --type h5 "--watch"

👽 Taro v3.2.2-beta.0

D:\code\weixin\taro-antd-mobile\node_modules\@tarojs\plugin-html\dist\index.js:14
    ctx.onParseCreateElement(({ nodeName, componentConfig }) => {
        ^

TypeError: ctx.onParseCreateElement is not a function
    at exports.default (D:\code\weixin\taro-antd-mobile\node_modules\@tarojs\plugin-html\src\index.ts:33:7)
    at Kernel.initPlugin (C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@tarojs\service\dist\Kernel.js:118:16)
    at Kernel.resolvePlugins (C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@tarojs\service\dist\Kernel.js:93:18)
    at Kernel.initPresetsAndPlugins (C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@tarojs\service\dist\Kernel.js:81:14)
    at Kernel.<anonymous> (C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@tarojs\service\dist\Kernel.js:40:18)
    at Generator.next (<anonymous>)
    at C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@tarojs\service\dist\Kernel.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@tarojs\service\dist\Kernel.js:4:12)
    at Kernel.init (C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@tarojs\service\dist\Kernel.js:36:16)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

(common) D:\code\weixin\taro-antd-mobile>
liudonghua123 commented 3 years ago

尝试运行 yarn dev:weapp 也提示i错误

(common) D:\code\weixin\taro-antd-mobile>yarn dev:weapp
yarn run v1.22.10
$ npm run build:weapp -- --watch

> taro-antd@1.0.0 build:weapp
> taro build --type weapp "--watch"

👽 Taro v3.2.2-beta.0

D:\code\weixin\taro-antd-mobile\node_modules\@tarojs\plugin-html\dist\index.js:14
    ctx.onParseCreateElement(({ nodeName, componentConfig }) => {
        ^

TypeError: ctx.onParseCreateElement is not a function
    at exports.default (D:\code\weixin\taro-antd-mobile\node_modules\@tarojs\plugin-html\src\index.ts:33:7)
    at Kernel.initPlugin (C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@tarojs\service\dist\Kernel.js:118:16)
    at Kernel.resolvePlugins (C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@tarojs\service\dist\Kernel.js:93:18)
    at Kernel.initPresetsAndPlugins (C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@tarojs\service\dist\Kernel.js:81:14)
    at Kernel.<anonymous> (C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@tarojs\service\dist\Kernel.js:40:18)
    at Generator.next (<anonymous>)
    at C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@tarojs\service\dist\Kernel.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@tarojs\service\dist\Kernel.js:4:12)
    at Kernel.init (C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\@tarojs\cli\node_modules\@tarojs\service\dist\Kernel.js:36:16)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

(common) D:\code\weixin\taro-antd-mobile>yarn why @tarojs\plugin-html
yarn why v1.22.10
[1/4] Why do we have the module "@tarojs\\plugin-html"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "@tarojs/plugin-html@3.3.0-alpha.2"
info Has been hoisted to "@tarojs/plugin-html"
info This module exists because it's specified in "dependencies".
info Disk size without dependencies: "68KB"
info Disk size with unique dependencies: "372KB"
info Disk size with transitive dependencies: "372KB"
info Number of shared dependencies: 1
Done in 0.98s.

(common) D:\code\weixin\taro-antd-mobile>
liudonghua123 commented 3 years ago

如果我暂时注释掉node_modules\@tarojs\plugin-html\dist\index.js中的 ctx.onParseCreateElement/ctx.modifyComponentConfig . 则yarn dev:h5/yarn dev:weapp 可以运行,没有再报错了。 似乎是@tarojs\plugin-html的版本与其他组件不匹配。

JeromeLin commented 3 years ago

看我这个issue #2

luckyadam commented 3 years ago

文档有误,需要安装 alpha 版本

npm i @tarojs/cli@alpha -g