1. Problem description:
First, the error is: During the operation of
configuring node
the version and etc., it is found that no matter whether it is installing dependencies or running the project, an error is reported:node-sass
element-plus
ERR! network request to https://registry.npmjs.org/@fortawesome%2fvue-fontawesome failed
ERR! network This is a problem related to network connectivity.
Chinese is:
错误! 对 https://registry.npmjs.org/@fortawesome%2fvue-fontawesome 的网络请求失败;
错误! 网络 这是与网络连接相关的问题;
Second, the error display is as follows:
2. Problem analysis:
According to the prompt, it should be a problem with the network, and see if it can be ping
connected . If there is still a problem, consider replacing the mirror image and other issues (because node.js
the site is abroad, and Taobao mirror is generally used in China );
3. Problem solving:
ping
First , let’s see if there is really a problem with the network service:
// display can ping
pass www.baidu.com
;
// display can ping
pass registry.npmjs.org
;
// display can ping
pass registry.npm.taobao.org
;
Second, according to the ping
above results, it should not be a network problem (but if the above ping
does not work, then it is 网络的问题
, or 关机重启下
);
Third, if there is no problem with the network, there is a high probability that it is 镜像
a problem. Execute the following statements in sequence (want to npmjs
switch to taobao
):
A. First check the current mirror image: command: npm config get registry
, mirror image:https://registry.npmjs.org/
B. Execute the following commands one by one. If it is displayed null
as execute 下一步 C、
it, otherwise execute the code in the brackets 下一步 C、
:
npm config get proxy
npm config get https-proxy
【
// The command here is: change the above display value 非 null
to 归 null
;】
npm config set proxy null
npm config set https-proxy null
C. Install Taobao image:
npm config set registry http://registry.taobao.org/
npm config get registry
At this point the mirror image becomes taobao
a mirror image :http://registry.taobao.org/
// Execute nmp install
the command , and node_modules
the file should be successfully generated;
D. If the problem of this error is still not resolved by this time ( 我的就是这样的
):
It is suggested 重启一次
that in windows
the system , 重启能解决 99%
the stubborn problem, my error is solved in this way;
4. Summary:
First, where there is something wrong or inappropriate, please give me some pointers and exchanges!
Second, 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