"Error in Cannot find module 'less'" when missing loaders chained after less. Revise error message.
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.
This error happens because npm@3 does not resolve peerDependencies anymore. npm install less less-loader is the way to go.
@victorwpbastos 's hint should work. I've added a note on peer dependencies to the README.
Thank you!
Thanks
thank U!
xiexieni
This error happens because npm@3 does not resolve
peerDependenciesanymore.npm install less less-loaderis the way to go.
Such an elegant fix.Webpack is back into action now.