gowravshekar / font-awesome-webpack

font-awesome package for webpack
MIT License
192 stars 49 forks source link

Module build failed: Error: Cannot find module 'less' #39

Open weituotian opened 7 years ago

weituotian commented 7 years ago
in ./node_modules/.0.26.4@css-loader!./node_modules/.2.2.3@less-loader!./node_modules/.0.0.5-beta.2@font-awesome-webpack/font-awesome-styles.loader.js!./node_modules/.0.0.5-beta.2@font-awesome-webpack/font-awesome.config.js
Module build failed: Error: Cannot find module 'less'
 @ ./node_modules/.0.13.2@style-loader!./node_modules/.0.26.4@css-loader!./node_modules/.2.2.3@less-loader!./node_modules/.0.0.5-beta.2@font-awesome-webpack/font-awesome-styles.loader.js!./node_modules/.0.0.5-beta.2@font-awesome-webpack/font-awesome.config.js 4:14-145 13:2-17:4 14:20-151
 @ ./node_modules/.0.0.5-beta.2@font-awesome-webpack/index.js
 @ ./node_modules/.7.1.2@babel-loader/lib!./node_modules/.13.5.0@vue-loader/lib/selector.js?type=script&index=0&bustCache!./src/components/Personal.vue
 @ ./src/components/Personal.vue
 @ ./src/router/index.js
 @ ./src/main.js
 @ multi ./build/dev-client ./src/main.js
Nogbit commented 7 years ago

I had the same problem and resolved it by installing the following packages

less url-loader file-loader

weituotian commented 7 years ago

@Nogbit thanks for your advice! i will try it!

JamesTheHacker commented 7 years ago

Same problem. Shouldn't the less module be a dependancy as it doesn't seem to work without it?

maximerety commented 6 years ago

@JamesJefferyUK

I don't think so as less isn't a direct dependency of font-awesome-webpack, but a peer dependency of less-loader(see package.json), which is itself a dependency of font-awesome-webpack (see package.json).

So it's up to the less-loader package to make it a normal dependency if needed, but they decided not to (see https://github.com/webpack-contrib/less-loader/pull/62#issuecomment-159414140).

More on peer dependencies in this good article: https://lexi-lambda.github.io/blog/2016/08/24/understanding-the-npm-dependency-model/

0ENZO commented 3 years ago

I had the same problem and resolved it by installing the following packages

less url-loader file-loader

I know the topic is kinda old but I had a recent problem with less-loader and webpack and this is exactly what I needed ! Thank you