mpvue-tutorials icon indicating copy to clipboard operation
mpvue-tutorials copied to clipboard

为什么我用克隆你这个配置提示‘platform’未定义?

Open xionHung opened this issue 5 years ago • 8 comments

E:\xion\mpvue-tutorials\node_modules\mpvue-template-compiler\build.js:5785 switch(fileExt.platform) { ^

TypeError: Cannot read property 'platform' of undefined at Object.compileToWxml (E:\xion\mpvue-tutorials\node_modules\mpvue-template-compiler\build.js:5785:20) at genComponentWxml (E:\xion\mpvue-tutorials\node_modules\mpvue-loader\lib\mp-compiler\index.js:33:63) at Timeout.createWxml [as _onTimeout] (E:\xion\mpvue-tutorials\node_modules\mpvue-loader\lib\mp-compiler\index.js:80:19) at ontimeout (timers.js:511:34) at tryOnTimeout (timers.js:323:5) at Timer.listOnTimeout (timers.js:290:5) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] dev: node build/dev-server.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache_logs\2019-03-12T07_29_48_435Z-debug.log

xionHung avatar Mar 12 '19 07:03 xionHung

应该是依赖的问题。是不是以前有安装过更高版本的依赖导致的?

noahlam avatar Mar 12 '19 09:03 noahlam

也碰到了,怎么解决呢

leitao0819 avatar Apr 21 '19 07:04 leitao0819

应该是 mpvue-template-compiler 的版本不一致导致的问题, 确认一下所安装的版本是否跟 package.json 里的一致。

noahlam avatar Apr 22 '19 02:04 noahlam

如果做兼容H5 与 小程序有什么好的建议吗,是不是要写2套config等文件,package.json 里的 script 也要2套?

tzzhmm avatar Aug 02 '19 02:08 tzzhmm

如果做兼容H5 与 小程序有什么好的建议吗,是不是要写2套config等文件,package.json 里的 script 也要2套?

兼容 2 套的话,除了 .vue 的文件,其他的个人感觉没有复用的意义,建议新建一个 H5 项目,然后把 .vue 文件拷过去,稍微再改一改代码。

或许,京东的 taro 会是更好的选择?

noahlam avatar Aug 03 '19 07:08 noahlam

项目运行不了

MiaoLiMing avatar Apr 06 '20 08:04 MiaoLiMing

@MiaoLiMing 更新了 mpvue 版本和相关依赖,具体请看 https://github.com/noahlam/mpvue-tutorials/blob/master/README.md

noahlam avatar Apr 08 '20 05:04 noahlam

@noahlam 谢了

MiaoLiMing avatar Apr 08 '20 06:04 MiaoLiMing