vue-项目中less报错 Module build failed: TypeError: loaderContext.getResolve is not a function问题解决以及安装less

报错

UnhandledPromiseRejectionWarning: TypeError: loaderContext.getResolve is not a function
UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a pr
omise which was not handled with .catch(). (rejection id: 1)
(node:6572) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non
-zero exit code.

参考文档:

参考文档

1.查看你的package.json文件

看你是否安装了less

"less": "^3.12.2",
"less-loader": "^4.1.0",

1.1安装less

用cnpm或者npm都可以

npm install less less-loader --save

1.2 打开build目录

在【build】文件下的【webpack.base.conf.js】文件中【rules】中加入

{
    test: /\.less$/,
    loader: "style-loader!css-loader!less-loader"
}

(根据自己需求)在你自己页面【style】标签里面写上【lang=“less”】

<style lang="less">
  industry-pro{width: 100%; height: 600px;}
</style>

1.3 下载依赖

cnpm i

1.4 然后启动项目

cnpm run dev

2 (loaderContext.getResolve is not a function问题解决)

2.1 降低版本(解决问题)

可以看到版本
然后修改版本

cnpm run dev

在这里插入图片描述

2.2 修改完成以后,重新执行命令

cnpm i

然后启动项目

3 问题解决

希望能够帮到您

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值