mpvue-tutorials
mpvue-tutorials copied to clipboard
为什么我用克隆你这个配置提示‘platform’未定义?
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
应该是依赖的问题。是不是以前有安装过更高版本的依赖导致的?
也碰到了,怎么解决呢
应该是 mpvue-template-compiler 的版本不一致导致的问题, 确认一下所安装的版本是否跟 package.json 里的一致。
如果做兼容H5 与 小程序有什么好的建议吗,是不是要写2套config等文件,package.json 里的 script 也要2套?
如果做兼容H5 与 小程序有什么好的建议吗,是不是要写2套config等文件,package.json 里的 script 也要2套?
兼容 2 套的话,除了 .vue 的文件,其他的个人感觉没有复用的意义,建议新建一个 H5 项目,然后把 .vue 文件拷过去,稍微再改一改代码。
或许,京东的 taro 会是更好的选择?
项目运行不了
@MiaoLiMing 更新了 mpvue 版本和相关依赖,具体请看 https://github.com/noahlam/mpvue-tutorials/blob/master/README.md
@noahlam 谢了