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

"Error in Cannot find module 'less'" when missing loaders chained after less. Revise error message.

Open TheLarkInn opened this issue 10 years ago • 7 comments

Issue at hand:

When a user forgets to install css-loader/style-loader and tries to chain these loaders with less loader as follows:

{test: /\.less$/ loader: 'style!css!less'}

The error that appears is Error in Cannot find module 'less'.

Expected Results:

That the user receives an error stating that webpack cannot find module 'css' or 'style'.

Maybe this is an issue needed to be filed with Webpack first but I wanted to start here since I've been seeing a few github issues and Stack Overflow questions regarding this.

TheLarkInn avatar Apr 21 '16 22:04 TheLarkInn

This error happens because npm@3 does not resolve peerDependencies anymore. npm install less less-loader is the way to go.

victorwpbastos avatar May 04 '16 05:05 victorwpbastos

@victorwpbastos 's hint should work. I've added a note on peer dependencies to the README.

jhnns avatar May 04 '16 07:05 jhnns

Thank you!

TheLarkInn avatar Aug 12 '16 04:08 TheLarkInn

Thanks

YuetTusi avatar Feb 24 '17 07:02 YuetTusi

thank U!

Nealyang avatar Sep 14 '17 08:09 Nealyang

xiexieni

pz422915432 avatar Oct 15 '19 08:10 pz422915432

This error happens because npm@3 does not resolve peerDependencies anymore. npm install less less-loader is the way to go.

Such an elegant fix.Webpack is back into action now.

ArunRamachandran avatar Feb 28 '20 22:02 ArunRamachandran