Skip to main content

Module not found: Error: Can't resolve 'less-loader' in 'XXX'

 This problem occurs when the less writing style is used in Vue. The reason for this problem is that the less-loader module is not installed, or the installed version is incompatible with the version of webpack. Therefore, an error occurs when using it, and the project cannot be started normally.

First check the webpack version: npm view webpack versions

View less-loader versions: npm view less-loader versions

Select your own corresponding less-loader version to install, I randomly choose the 10 version here: npm i less-loader@10

If the installation is unsuccessful, uninstall it, and then choose another version to install: npm uninstall less-loader


Comments

Popular posts from this blog

A simple understanding of ES6 iterators

 What is an iterator?An iterator is an interface that provides a unified access mechanism for various data structures. Any data structure can complete the traversal operation as long as the iterator interface is deployed.ES6 created a new traversal command for...of loop, which natively has a data structure with the iterator interface (which can be traversed with for...of). Contains Array, Arguments, Set, Map, String, TypedArray, NodeList. Of course, you can also implement this interface manually, which is convenient for practical use.