The cause and solution of the problem of 'sass_binary_site' is not a valid npm option
Problem background:
When installing node in the vscode terminal, the following command will be executed
npm config set registry https://registry.npm.taobao.org
npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
npm config set phantomjs_cdnurl=https://npm.taobao.org/mirrors/phantomjs/
when executed to
npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
When the console pops up this error
I found a lot of solutions but it didn't work, and then I got stuck
problem causes:
The node version does not match the sass version. The node version I use is too high. After installation, execute
node -v
You can view the installed version of node
I was using 18.16.0
Solution:
Uninstall the installed node, go to Download | Node.js (nodejs.org) to download and install the previous version
I downloaded version 14.21.3. After installation, check the node version in cmd. If 14.21.3 is displayed, the installation is successful.
Go back to vscode to execute the three commands at the beginning of the article, and the following page is displayed as success
problem solved