less-loader icon indicating copy to clipboard operation
less-loader copied to clipboard

Error while compiling less files

Open maheshiv opened this issue 11 years ago • 24 comments

In my terminal i ran Maheshs-MacBook-Pro:sample mahesh$ node_modules/.bin/webpack --module-bind 'less=style!css!less' I am getting below error ERROR in ./~/css-loader!./~/less-loader!./~/style-loader!./~/css-loader!./~/less-loader!./~/bootstrap/less/bootstrap.less Module build failed: Unrecognised input

maheshiv avatar Aug 14 '15 08:08 maheshiv

I have exactly the same error. @maheshiv did you solve it? If yes, could you share the solution?

mayacode avatar Oct 22 '15 14:10 mayacode

same

sheerun avatar Jul 21 '16 10:07 sheerun

same here

flowdee avatar Aug 02 '16 14:08 flowdee

I was getting the same error when I had two loaders for less in webpack.config

pterolex avatar Aug 02 '16 15:08 pterolex

~~I also have this error.~~ This problem has been resolved after removing an another loader setting.

jongha avatar Nov 19 '16 06:11 jongha

I was getting the same error when I had two loaders for less in webpack.config

Yep, that's also the case here as you can see in the console output 😁

jhnns avatar Mar 20 '17 19:03 jhnns

same here

` error in ./~/bootstrap/less/bootstrap.less

Module build failed:

// load the styles var content = require("!!../../css-loader/index.js?{"minimize":false,"sourceMap":false}!../../less-loader/dist/cjs.js?{"sourceMap":false}!./bootstrap.less"); ^ Unrecognised input in D:\web\vue\iot\node_modules\bootstrap\less\bootstrap.less (line 4, column 12)

@ ./~/bootstrap/less/bootstrap.less 4:14-207 18:2-22:4 19:20-213 @ ./src/main.js @ multi ./build/dev-client ./src/main.js

error in ./~/style-loader/lib/addStyles.js

Module build failed: Error: ENOENT: no such file or directory, open 'D:\web\vue\iot\node_modules\style-loader\lib\addStyles.js' at Error (native)

@ ./~/bootstrap/less/bootstrap.less 12:13-60 @ ./src/main.js @ multi ./build/dev-client ./src/main.js `

think2cat avatar Aug 28 '17 07:08 think2cat

how to resolve?

holidaying avatar May 17 '18 08:05 holidaying

image

holidaying avatar May 17 '18 08:05 holidaying

have you solved it?

Yunnkii avatar May 30 '18 04:05 Yunnkii

@holidaying 把你的less文件发上来看看

think2cat avatar May 31 '18 02:05 think2cat

same

arixse avatar Jul 31 '18 02:07 arixse

What f* for this error, It does not show anything about how to resolve or debug with it, So f* foolish.

givingwu avatar Aug 20 '18 09:08 givingwu

some happen to me today, i am so confused, how to solve

miraclesumail avatar Aug 22 '18 03:08 miraclesumail

有中国人吗 怎么弄

miraclesumail avatar Aug 22 '18 03:08 miraclesumail

有中国人吗 怎么弄 pterolex说的是正解,我遇到同样问题,原因也是在webpack config里重复写了两次less loader的配置。去掉其中一个就ok了。

majorcool avatar Oct 28 '18 12:10 majorcool

If this is happens due to your file matching two different match clauses, you can resolve it by either making patterns mutually exclusive, or by changing the extension of the .less file and having second pattern match against it. It's not the prettiest solution, though.

tail-call avatar Dec 14 '18 05:12 tail-call

有中国人吗 怎么弄 pterolex说的是正解,我遇到同样问题,原因也是在webpack config里重复写了两次less loader的配置。去掉其中一个就ok了。

是的,我就是删除webpack.base.conf 里的{ test: /.less$/, use: [{ loader: 'style-loader', }, { loader: 'css-loader', // translates CSS into CommonJS }, { loader: 'less-loader', // compiles Less to CSS options: { modifyVars: { 'primary-color': '#1DA57A', 'link-color': '#1DA57A', 'border-radius-base': '2px', } }, }] } 修改build/utils 里的less: generateLoaders('less', { javascriptEnabled: true }) 解决的。

确实可行。但.less文件里面不能写style标签,更没有scoped这样的命名空间了。会不会到时候样式串掉

qinghua5453 avatar Mar 01 '19 07:03 qinghua5453

哎。不得不说,以前自己配置webpack的时候 坑相对还少一些,虽然辛苦是辛苦了一点,但都是一个一个loader配置进去的,虽然不怎么健壮。自从用了cli后,发现遇到问题除了google来git上找问题,基本很难自己发现。坑也很难察觉。

qinghua5453 avatar Apr 02 '19 07:04 qinghua5453

有中国人吗 怎么弄 pterolex说的是正解,我遇到同样问题,原因也是在webpack config里重复写了两次less loader的配置。去掉其中一个就ok了。

是的,我就是删除webpack.base.conf 里的{ test: /.less$/, use: [{ loader: 'style-loader', }, { loader: 'css-loader', // translates CSS into CommonJS }, { loader: 'less-loader', // compiles Less to CSS options: { modifyVars: { 'primary-color': '#1DA57A', 'link-color': '#1DA57A', 'border-radius-base': '2px', } }, }] } 修改build/utils 里的less: generateLoaders('less', { javascriptEnabled: true }) 解决的。

确实可行。但.less文件里面不能写style标签,更没有scoped这样的命名空间了。会不会到时候样式串掉

没有遇到你说的这个问题,这个是覆盖某个库文件的 modifyVars 变量而已

我也出现,没法在less文件写style标签,就没法写scope这样的变量空间。

qinghua5453 avatar Apr 02 '19 07:04 qinghua5453