When starting the project to download dependencies (npm i or npm i -f), an error is reported. The node-sass problem has been solved.

Question 1) Error message:The node version does not match node-sass

 The consideration here is that node version does not match node-sass . Below is the official version comparison table. Click to enter the official website address: node-sass - npm

 Open the terminal and enter node -v View The current node version number; Since the node-sass version number used in the project file is 4.13.1, after comparing the above table, we found that the node version must be 13, and I The node version here is 12, you need to change the node version

 

Regarding how to use nvm to download other versions of node and switch, the blogger has written this article in detail before, so I won’t explain it further here. Friends in need can click here:Use nvm to switch node versions freelyWhen managing multiple projects, the project cannot start normally due to node problems, use nvm Version management tool: The full name is node.js version management, through which you can install and switch different versions of node. Download, installation and usage instructions are listed below. _nvm select versionhttps://blog.csdn.net/weixin_73318685/article/details/130260750?spm=1001.2014.3001.5501 Use nvm version manager to download version starting with node13 and then restartnpm i -f,Here, taking the node version 13.14.0 as an example, we found that another error occurred (Note: < /span>), as shown in the figure:The node version at this time matches the node-sass version normally

 Question 2) According to the prompts, another problem occurred at this time: The node version does not match the npm version, and the corresponding npm version needs to be adjusted.

Official websiteThe corresponding relationship between node and npm is shown in the figure (Official website click here: https ://nodejs.org/en/download/releases):

Switch npm version

npm install -g [email protected] 

After the switch is successful, download the dependent input command again npm i -f,An error message appears again, as shown in the figure:

Question 3) gyp error:

 Solution: Use the specified command below to skip the compilation step of Node Sass and you can download and start the project successfully~

npm install --ignore-scripts

Expansion: Many beginners may not understand here npm i -f  What does it mean? Usually download the project dependency package and use it npm i If an error is reported, I will give priority to using npm i -f to force the download of dependencies , sometimes you can resolve some errors first, and there have been no other problems since using it, so I prefer to use -f for forced downloading 

In addition to the above problems, if anyone encounters other problems, please feel free to send a private message or leave a message below~ The blogger will reply as soon as possible!

Guess you like

Origin blog.csdn.net/weixin_73318685/article/details/131642600