Vue报错:Failed to resolve loader:less-loader

Not long after, the <style scoped lang="less"> sentence I copied in the code killed me again. I didn't find the words "less-loader": "^XXX" in package.json, good guy I didn't pretend. Sure enough, all the solutions I found on the Internet told me to pretend

  • npm install less less-loader --save-dev =>ERESOLVE could not resolve
  • npm install less --save-dev =>ERESOLVE could not resolve, pro-test not work
  • npm install less --save-dev -force =>ERESOLVE overriding peer dependency, it still doesn't work once running

None of the above will work. The Internet said that there is a version problem and asked me to lower the version of less-loader

  Figure 1: Failed to resolve loader:less-loader error reported when running npm run serve

Start to solve the version problem:

Figure 2: The closest thing to a solution: downgrading the version

 Figure 3: --force turns the tide

Figure 4: Running successfully

Guess you like

Origin blog.csdn.net/qq_54727445/article/details/128392672