Vue3 solution: three solutions for npm ERR! network request to https://registry.npmmirror.com/node-sass failed

1. Problem description:

First, the overall error is:
the installation command is:npm i node-sass

npm ERR! code ETIMEDOUT
npm ERR! syscall connect
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmmirror.com/node-sass failed, reason: connect ETIMEDOUT 240e:e9:d804:0:3::3fb:443
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! network request to https://registry.npmmirror.com/node-sass failed, reason: connect ETIMEDOUT 240e:e9:d804:0:3::3fb:443

Chinese is:

npm 错误! 到 https://registry.npmmirror.com/node-sass 的网络请求失败,原因:连接 ETIMEDOUT 240e:e9:d804:0:3::3fb:443

Second, the problem is described as:

I want to vue3support the language in the project <style lang="scss" scoped>, so I want node-sassand sass-loaderto achieve my goal, but an error is reported during the installation process;

Third, the error display is as follows:

insert image description here

2. Problem analysis:

First, according to the error message in Chinese:

According to the error message in Chinese, it is clear that it is a problem with the mirror image (that is, a problem with the connected network), which makes it impossible to access the node-sassdownload address of ;

Second, the idea of ​​​​solving the problem:

In general, there are only two solutions:

A. Switch to node-sassthe mirror address of download, etc.;

B. Use some instructions to enable node-sasssuccessful download;

3. Problem solving:

Method 1. Switch the downloaded mirror address:

A. The command to view the current address is:npm config get registry

insert image description here
B. The command to switch address is:npm config set registry http://registry.npm.taobao.com

insert image description here
C. The mirror address at this time is:http://registry.npm.taobao.com

D. Enter the command again npm i node-sass, and the problem can generally be solved;

Method 2: Command to switch the downloaded node-sassimage address:

A. The download command is:

npm install node-sass --sass-binary-site=http://npm.taobao.org/mirrors/node-sass

B. At this time, the problem can generally be solved;

Method 3. If the above two steps do not solve the problem, you can try to restart the computer:

At this time, enter the command again npm i node-sass, and the problem can generally be solved;

[
     Note: In vue3the project of , because nodethe version of is relatively high, node-sassthe version of is generally relatively high
     , but sometimes sassit may need to be installed because of the version of , sassthe command is:npm i sass

// The error message of sass is:
insert image description here

4. Summary:

First, where there is something wrong or inappropriate, please give me some pointers and exchanges!
Second, if you repost or quote the content of this article, please indicate the address of this blog https://blog.csdn.net/weixin_43405300. Creation is not easy, but it can be done and cherished!
Third, if you are interested, you can pay more attention to this column (Vue (Vue2+Vue3) interview must-have column):https://blog.csdn.net/weixin_43405300/category_11525646.html?spm=1001.2014.3001.5482

Guess you like

Origin blog.csdn.net/weixin_43405300/article/details/131717884