question:
After npm i installed the dependency package, the node-sass plugin reported an error when starting the project
The error is as follows
environment:
The node version is 14.19.3
The node-sass plug-in version is shown in the figure
solve:
Delete or uninstall the previously installed node-sass dependency package, or directly delete the entire node-modules package
If package.json and package-lock.json exist, try to keep the node-sass versions in the two files consistent
Solution 1: After npm i is downloaded, install it with a separate command
npm install node-sass
Solution 2: If the version in package.json is too high, you can refer to this picture to upgrade/downgrade the local node environment or node-sass
You can refer to this article for node upgrade and upgrade: Installation and use of nvm node package manager (super detailed)
The upgrade and upgrade of node-sass can directly modify the version in package.json, and then re-download the dependent package with npm i. You can also use the following command to download the specified version
npm install [email protected]