One way to solve vue sass related errors

The main reason for this type of error is that the nodejs version is too high. Each node version has a corresponding compatible node-sass and sass-loader version. If the version is incompatible, an error will be reported! ! !

First uninstall all previously installed dependencies related to sass, or delete the node_modules and package-lock.json files directly.

Just do the following and then run the project:

Install sass-loader:

npm install [email protected] --save-dev

Install node-loader:

npm install [email protected]

Install style-loader

npm install style-loader --save-dev

or:

Just change the node-sass and sass-loader versions in package.json to: "node-sass": "^4.11.1", "sass-loader": "^7.3.0"

node-sass error:

Generally speaking, it is caused by the inconsistency between the node -sass in the project and the local node environment. First check the node-sass version referenced in the project, and then compare the node version in the local environment to make the corresponding choice, or modify the node-sass in the project. version, or modify the local environment node version.

Query the node.js version corresponding to node-sass. https://github.com/sass/node-sass/releases?page=1

You can see that the highest version of node.js supported by node-sass 4.14.1 is 14. If the local version is greater than version 14, you need to lower the local node version.

Guess you like

Origin blog.csdn.net/weixin_52691965/article/details/125925959