ERROR in .srccomponentsSchool.vuevue&type=style&index=0&id=3375b0b8&lang=less&scoped=true&

ERROR in ./src/components/School.vue?vue&type=style&index=0&id=3375b0b8&lang=less&scoped=true&

Module build failed: Error: Cannot find module ‘less’

1. Take a screenshot of the error message

insert image description here

2. Solution

Why do you report an error? Let’s talk about the reason for the error: Scaffolding needs to be supported by webpack. Since the current webpack version has reached version 5, the currently used webpack version is 5.76.3, and less-loader8 less-loder9 caters to webpack5

2.1. View the version currently used by webpack

npm view webpack version

insert image description here

2.2 View all versions of wekpack

npm view webpack versions

insert image description here

2.3 Check the version of less-loader

npm view less-loader  versions

2.4 Before uninstalling

npm uninstall less --save 
npm uninstall less-loader --save


2.4 Enter the official website after knowing your own version

Search webpack, enter the official website - "documentation - "loaders

For example, if I want to load the loader of css, enter Style-"lss-loader to view its installation and configuration

You can refer to here

relevant_paycolumn_v3&utm_relevant_index=5

Guess you like

Origin blog.csdn.net/weixin_45572279/article/details/129752740