vue项目安装lees-loader报错:Module build failed: Error: Cannot find module 'less'

1-新搭建的一个项目,运行时报Module build failed: Error: Cannot find module 'less'错误

原因:vue文件里面的style添加了 lang="less" 

解决方案: 安装less     npm install less


2-安装less后运行报错:

Module build failed: TypeError: this.getOptions is not a function

    at Object.lessLoader (F:\myvue\page\node_modules\less-loader\dist\index.js:19:24) 作者:丘奇小怪 https://www.bilibili.com/read/cv16288686/ 出处:bilibili

原因是less版本过高导致webpack编译失败,降低版本即可: 先删除之前的版本

npm uninstall less-loader    npm install [email protected] --save-dev

3-然后  直接报错 GET/CANNOT...

安装指定less版本解决:

-D: 本地安装

-g: 全局安装

npm install [email protected] [email protected] -D

只要思想不滑坡,办法总比困难多!

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章