A list,

  • Install the Less

    $NPM I less less loader -d $NPM I less loader -d $NPM I less loader -d $NPM I less loader -d $NPM I less loader -dCopy the code
  • However, the less-loader installation fails, and an error message is displayed:

    npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! Found: [email protected] NPM ERR! node_modules/webpack npm ERR! Peer webpack@"^4.0.0" from @intervolga/[email protected] NPM ERR! node_modules/@intervolga/optimize-cssnano-plugin npm ERR! @intervolga/optimize-cssnano-plugin@"^1.0.5" from @vue/[email protected] NPM ERR! node_modules/@vue/cli-service npm ERR! Peer @ vue/cli - service @ "^ 3.0.0 | | ^ 4.0.0-0" from @ vue/[email protected] NPM ERR! node_modules/@vue/cli-plugin-babel npm ERR! Dev @vue/cli-plugin-babel@"~4.5.0" from the root project NPM ERR! 3 more (@vue/cli-plugin-router, @vue/cli-plugin-vuex, the root project) npm ERR! Peer webpack @ "^ 4.0.0 | | ^ 5.0.0" from @ soda/[email protected] NPM ERR! node_modules/@soda/friendly-errors-webpack-plugin npm ERR! @soda/friendly-errors-webpack-plugin@"^1.7.1" from @vue/[email protected] NPM ERR! node_modules/@vue/cli-service npm ERR! Peer @ vue/cli - service @ "^ 3.0.0 | | ^ 4.0.0-0" from @ vue/[email protected] NPM ERR! node_modules/@vue/cli-plugin-babel npm ERR! Dev @vue/cli-plugin-babel@"~4.5.0" from the root project NPM ERR! 3 more (@vue/cli-plugin-router, @vue/cli-plugin-vuex, the root project) npm ERR! 16 more (@vue/cli-plugin-babel, @vue/cli-service, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! dev less-loader@"*" from the root project npm ERR! npm ERR! Conflicting Peer Dependency: [email protected] NPM ERR! node_modules/webpack npm ERR! Peer webpack@"^5.0.0" from [email protected] NPM ERR! node_modules/less-loader npm ERR! dev less-loader@"*" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! See /Users/dengzemiao/.npm/eresolve-report.txt for a full report. npm ERR! A complete log of this run can be found in: npm ERR! /Users/dengzemiao/.npm/_logs/2021-07-06T01_37_12_820Z-debug.logCopy the code
  • This means that the NPM version is too low or the less-loader version is too high. Just upgrade the NPM or lower the installed version of less-Loader. The same goes for other CSS parsers.

Second, to reduce theless-loaderversion

  • How do I reduce the less-Loader version?

  • A:

    1. Create a project and select the Less that comes with Vue. After creating the project, find package.json file and check the corresponding version of Less and less-Loader to know the current support status.

    2. After knowing the version, install the specified version

    $NPM I [email protected] -d $NPM I [email protected] -dCopy the code

    3. After successful installation, the project will take effect only after re-running.

  • Method 2:

    1. Directly install the latest version of Less, search the less-Loader using NPM to view the version list, and manually install the earlier version if it can be successfully installed

    2. Install less

    $ npm i less -D
    Copy the code

    3. Search for less-Loader on the NPM official website to obtain the version list

    4, and then a version of the installation, until the installation is successful.

    $NPM I [email protected] -dCopy the code

    5. After successful installation, the project will take effect only after re-running.