webpack error in Cannot find module 'less'
I had the same issue. ERROR in Cannot find module 'less'
├── UNMET PEER DEPENDENCY file-loader@*
├── UNMET PEER DEPENDENCY less@^2.3.1
├── [email protected]
└── [email protected]
npm WARN EPEERINVALID [email protected] requires a peer of less@^2.3.1
but none was installed.
npm WARN EPEERINVALID [email protected] requires a peer of file-loader@*
but none was installed.
I tried as follows:
npm install --save-dev less
npm install --save-dev file-loader
Then it solved the issues.
This error happens because npm@3 does not resolve peerDependencies any more.
npm install less less-loader
is the way to go.
I had the same issue with a .Net Core project. I resolved this by adding less to my package.json file as well as less-loader.
"less-loader": "2.2.3",
"less": "2.7.2"
It sounds like you haven't installed the less-loader
into your node_modules. Installing it would fix this.
npm install less-loader --save-dev
Edit: Also you will get this error when you haven't installed the css-loader
and style-loader
that you are chaining less-loader
to.
Anyone who comes across this can plus on the issue I submitted for the bad message. "Error in Cannot find module 'less'" when missing loaders chained after less. Revise error message.