webpack error in Cannot find module 'less'

后端 未结 8 1321
渐次进展
渐次进展 2021-02-03 21:30

I\'m trying to use less loader in webpack and the issues is - I\'ve installed less loader locally, but when I try to compile everything using webpack command in bask, it prints

相关标签:
8条回答
  • 2021-02-03 22:18

    @Zhorian yours works awesome, I cannot vote cuz of the low level and neither add comment on your answer! after doing npm install less --save-dev, it works, for the error:

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

    and when you try to install:

    npm install less-loader style-loader css-loader --save-dev
    

    It will gave you:

    ├── css-loader@0.26.1
    ├── UNMET PEER DEPENDENCY less@^2.3.1
    ├── less-loader@2.2.3
    └── style-loader@0.13.1
    
    0 讨论(0)
  • 2021-02-03 22:23

    I meet the error also when I have installed less and less-loader both. then I try uninstall them and install them again but not make sense.

    Lastly, I find delete the last dist(already exit) can make 'npm run build' right. So, you can try delete the 'dist' dir if it already exits.

    0 讨论(0)
提交回复
热议问题