WePY 2.x 安装 pug

在wepy1.0,直接使用 npm install pug 来安装是没有问题的,可是在wepy2.0的版本会报错
WePY 2.x 安装 pug
这里说需要安装插件 wepy-compiler-pug,按照这个报错信息,我们直接安装npm install wepy-compiler-pug --save-dev ,然后在wepy.config.js配置
pug: {
pretty: false
},
WePY 2.x 安装 pug
依然报错,还是找不到wepy-compiler-pug,Not Found - GET https://registry.npmjs.org/@wepy%2fcompiler-pug - Not found
这里可以看到,指向的插件库找不到wepy-compiler-pug,所以导致安装失败了。
既然这个默认的官方插件库找不到,我们就找其他的插件库
于是找到了这个地址
https://github.com/Riant/wepy2-compiler-pug.git#master -D
如果你是yarn
yarn add @wepy/[email protected]://github.com/Riant/wepy2-compiler-pug.git#master -D
如果你是npm
npm install @wepy/[email protected]+https://github.com/Riant/wepy2-compiler-pug.git#master --save-dev

等待下载完成之后 wepy build --watch 运行项目,如果还是不行,建议先删除node_modules 和打包文件,重新打包 npm install 再 wepy build --watch 如果可以运行,那恭喜。

----------------结尾
---------------本人是菜鸟一枚,有待提升,大家共同学习--------