[英]NPM and Yarn cant install anything
I tried every single Stackoverflow answer .我尝试了每一个 Stackoverflow 答案。 I'm super new to Node and I installed Node v12.16.2 on my Windows 10. It had NPM v 6.14.4.我是 Node 的超级新手,我在 Windows 10 上安装了 Node v12.16.2。它有 NPM v 6.14.4。 When I install anything NPM showed当我安装任何 NPM 显示
rollbackFailedOptional: verb npm-session c0117abdee5b38c1
npm ERR! code E404
npm ERR! 404 Not Found - GET http://registry.npmjs.org/react
I did quite a lot fixes reading stackoverflow, I reinstalled node, but still i got no change in the error.我做了很多修复阅读stackoverflow,我重新安装了节点,但我仍然没有改变错误。 I installed yarn using their installer.我使用他们的安装程序安装了纱线。 Installing anything in Yarn shows,在 Yarn 节目中安装任何东西,
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.npmjs.org/react: tunneling socket could not be established, cause=Hostname/IP does not match certificate's altnames: Host: registry.npmjs.org. is not in the cert's altnames: DNS:www.google.com".
Some Stackoverflow answers say its some DNS entry being cached or something.一些 Stackoverflow 答案说它的一些 DNS 条目被缓存或其他东西。 I have no clue what to do.我不知道该怎么做。 If nothing works, is there a way to install packages without using NPM.( like copying files from another computer )如果没有任何效果,有没有办法在不使用 NPM 的情况下安装软件包。(比如从另一台计算机复制文件)
I took a look at my yarn config list
.我看了看我的yarn config list
。 It had a lot more than what it needed with many proxy entries, strict-ssl stuff and many more.它具有许多代理条目、严格 ssl 的东西等等,远远超出了它所需要的。 I deleted everything and started adding whats needed.我删除了所有内容并开始添加所需的内容。 And now I'm able to install again.现在我可以再次安装。 Here's my yarn config list
:这是我的yarn config list
:
yarn config v1.22.4
info yarn config
{
'version-tag-prefix': 'v',
'version-git-tag': true,
'version-commit-hooks': true,
'version-git-sign': false,
'version-git-message': 'v%s',
'init-version': '1.0.0',
'init-license': 'MIT',
'save-prefix': '^',
'bin-links': true,
'ignore-scripts': false,
'ignore-optional': false,
registry: 'https://registry.yarnpkg.com',
'strict-ssl': true,
'user-agent': 'yarn/1.22.4 npm/? node/v12.16.2 win32 x64'
}
info npm config
{
registry: 'https://registry.npmjs.org/'
}
You can flush your local DNS cache in Windows by following these easy steps:您可以按照以下简单步骤刷新 Windows 中的本地 DNS 缓存:
Windows 7: Windows 7:
Open Start menu打开开始菜单
Click Run单击运行
Type cmd
and press enter键入cmd
并按 Enter
In the Command Prompt type ipconfig /flushdns
and press Enter在命令提示符中键入ipconfig /flushdns
并按 Enter
Windows 8, 10: Windows 8、10:
On your keyboard, press Win+X to open the WinX Menu在键盘上,按 Win+X 打开 WinX 菜单
Right-click Command Prompt and select Run as Administrator右键单击命令提示符并 select 以管理员身份运行
Run this command ipconfig /flushdns
and press Enter运行此命令ipconfig /flushdns
并按 Enter
Source: https://www.siteground.com/kb/how_to_clear_the_local_dns_cache_in_windows/资料来源: https://www.siteground.com/kb/how_to_clear_the_local_dns_cache_in_windows/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.