NPM 和 Yarn 无法安装任何东西
NPM and Yarn cant install anything
我尝试了每一个 Whosebug 答案。我是 Node 的超级新手,我在 Windows 10 上安装了 Node v12.16.2。它有 NPM v 6.14.4。当我安装 NPM 显示的任何东西时
rollbackFailedOptional: verb npm-session c0117abdee5b38c1
npm ERR! code E404
npm ERR! 404 Not Found - GET http://registry.npmjs.org/react
我在阅读 Whosebug 时做了很多修复,我重新安装了节点,但我的错误仍然没有改变。
我使用他们的安装程序安装了纱线。在 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".
一些 Whosebug 的回答说它的一些 DNS 条目被缓存或什么的。我不知道该怎么办。如果没有任何效果,有没有办法不使用 NPM 来安装包。(比如从另一台计算机复制文件)
如何清除Windows中的本地DNS缓存?
您可以按照以下简单步骤刷新 Windows 中的本地 DNS 缓存:
Windows 7:
打开“开始”菜单
点击运行
键入 cmd
并按回车键
在命令提示符中键入 ipconfig /flushdns
并按 Enter
Windows 8, 10:
在键盘上,按 Win+X 打开 WinX 菜单
右键单击命令提示符并select 运行 以管理员身份
运行 这个命令 ipconfig /flushdns
然后按 Enter
来源:https://www.siteground.com/kb/how_to_clear_the_local_dns_cache_in_windows/
我看了看我的 yarn config list
。它有许多代理条目、strict-ssl 东西等等,远远超过它所需要的。我删除了所有内容并开始添加所需内容。现在我可以再次安装了。这是我的 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/'
}
我尝试了每一个 Whosebug 答案。我是 Node 的超级新手,我在 Windows 10 上安装了 Node v12.16.2。它有 NPM v 6.14.4。当我安装 NPM 显示的任何东西时
rollbackFailedOptional: verb npm-session c0117abdee5b38c1
npm ERR! code E404
npm ERR! 404 Not Found - GET http://registry.npmjs.org/react
我在阅读 Whosebug 时做了很多修复,我重新安装了节点,但我的错误仍然没有改变。 我使用他们的安装程序安装了纱线。在 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".
一些 Whosebug 的回答说它的一些 DNS 条目被缓存或什么的。我不知道该怎么办。如果没有任何效果,有没有办法不使用 NPM 来安装包。(比如从另一台计算机复制文件)
如何清除Windows中的本地DNS缓存?
您可以按照以下简单步骤刷新 Windows 中的本地 DNS 缓存:
Windows 7:
打开“开始”菜单
点击运行
键入 cmd
并按回车键
在命令提示符中键入 ipconfig /flushdns
并按 Enter
Windows 8, 10:
在键盘上,按 Win+X 打开 WinX 菜单
右键单击命令提示符并select 运行 以管理员身份
运行 这个命令 ipconfig /flushdns
然后按 Enter
来源:https://www.siteground.com/kb/how_to_clear_the_local_dns_cache_in_windows/
我看了看我的 yarn config list
。它有许多代理条目、strict-ssl 东西等等,远远超过它所需要的。我删除了所有内容并开始添加所需内容。现在我可以再次安装了。这是我的 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/'
}