[Solved] Vue installs less Error: Failed to compile with 1 errors

1. Install less after creating the vue project, execute npm install less less-loader –save-dev
The download version is: [email protected], [email protected], restart the service and report an error, the error message is as follows:

2. The reason for the error is less. The version is too high and the version needs to be lowered to execute the code.
Remove the previous version first:

 

npm uninstall less-loader

Download the specified version:

npm install [email protected] -D

3. Restart the code, if you still report an error, you can remove the file node_modules and download cnpm install again
Supplementary knowledge: Vue project operation error: 94% asset optimization ERROR Failed to compile with 2 errors 13:03:01 error in ./src/ba
The front-end project written using vue reports an error:

88% hashing
89% module assets processing
90% chunk assets processing
94% asset optimization ERROR Failed to compile with 2 errors13:03:01
error in ./src/base/components/head.vue
Module build failed: Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (72)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.7.2
at module.exports (F:\teach\xcEdu\xcEduUI01\xc-ui-pc-sysmanage\node_modules\node-sass\lib\binding.js:13:13)
at Object.<anonymous> (F:\teach\xcEdu\xcEduUI01\xc-ui-pc-sysmanage\node_modules\node-sass\lib\index.js:14:35)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Module.require (internal/modules/cjs/loader.js:1042:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (F:\teach\xcEdu\xcEduUI01\xc-ui-pc-sysmanage\node_modules\sass-loader\lib\loader.js:3:14)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Module.require (internal/modules/cjs/loader.js:1042:19)
at require (internal/modules/cjs/helpers.js:77:18)
at loadLoader (F:\teach\xcEdu\xcEduUI01\xc-ui-pc-sysmanage\node_modules\loader-runner\lib\loadLoader.js:13:17)

@ ./node_modules/vue-style-loader!./node_modules/css-loader?{“sourceMap”:false}!./node_modules/vue-loader/lib/style-compiler?{“vue”:true,”id”:”data-v-1340bee1″,”scoped”:true,”hasInlineConfig”:false}!./node_modules/sass-loader/lib/loader.js?{“sourceMap”:false}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0&bustCache!./src/base/components/head.vue 4:14-395 13:3-17:5 14:22-403
@ ./src/base/components/head.vue
@ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0&bustCache!./src/module/home/page/home.vue
@ ./src/module/home/page/home.vue
@ ./src/module/home/router/index.js
@ ./src/base/router/index.js
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:11000 webpack/hot/dev-server ./src/main.js

error in ./src/module/home/page/home.vue

Module build failed: Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (72)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.7.2
at module.exports (F:\teach\xcEdu\xcEduUI01\xc-ui-pc-sysmanage\node_modules\node-sass\lib\binding.js:13:13)
at Object.<anonymous> (F:\teach\xcEdu\xcEduUI01\xc-ui-pc-sysmanage\node_modules\node-sass\lib\index.js:14:35)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Module.require (internal/modules/cjs/loader.js:1042:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (F:\teach\xcEdu\xcEduUI01\xc-ui-pc-sysmanage\node_modules\sass-loader\lib\loader.js:3:14)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Module.require (internal/modules/cjs/loader.js:1042:19)
at require (internal/modules/cjs/helpers.js:77:18)
at loadLoader (F:\teach\xcEdu\xcEduUI01\xc-ui-pc-sysmanage\node_modules\loader-runner\lib\loadLoader.js:13:17)

The reason for the error is that sass does not support the current environment, so just reinstall it in the current environment.
1. Check the version number of local nodejs and node-sass
node -v —Check the version number of nodejs and check whether it is installed
node-sass -v —Check the version number of node-sass and check whether it is installed
2. Uninstall node-sass, but if the uninstallation is unsuccessful, directly find the node-sass folder and delete it
npm uninstall –save node-sass –Remember that before executing this command, you need to enter the corresponding file directory before you can delete
As shown in the figure (as shown below):

3. Reinstall the updated version of node-sass

npm install –save node-sass (cnpm install –save node-sass )

(This should also be executed in the specified folder and installed locally)
that’s it! ! ! ! ! ! ! ! !
As shown below:

Similar Posts: