簡體   English   中英

NPM 和 Yarn 無法安裝任何東西

[英]NPM and Yarn cant install anything

我嘗試了每一個 Stackoverflow 答案 我是 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

我做了很多修復閱讀stackoverflow,我重新安裝了節點,但我仍然沒有改變錯誤。 我使用他們的安裝程序安裝了紗線。 在 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".

一些 Stackoverflow 答案說它的一些 DNS 條目被緩存或其他東西。 我不知道該怎么做。 如果沒有任何效果,有沒有辦法在不使用 NPM 的情況下安裝軟件包。(比如從另一台計算機復制文件)

我看了看我的yarn config list 它具有許多代理條目、嚴格 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/'
}

如何清除Windows中的本地DNS緩存?

您可以按照以下簡單步驟刷新 Windows 中的本地 DNS 緩存:

Windows 7:

打開開始菜單

單擊運行

鍵入cmd並按 Enter

在命令提示符中鍵入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/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM