Angular Material安装失败

huangapple go评论114阅读模式
英文:

Angular Material installation fail

问题

我在我的工作Windows笔记本电脑上使用以下版本。

  • Angular CLI: 9.1.15
  • Node: 16.16.0
  • 操作系统: win32 x64
  • Windows 10

当我使用以下命令添加Angular Material ng add @angular/material 时,运行正常。

在我允许安装之后,它显示以下错误。

> 将安装并执行 @angular/material@16.1.5 包。
> 您是否要继续?是
> npm 警告 配置 global --global,--local 已被弃用。请改用 --location=global。
> npm 错误!错误代码 ECONNRESET
> npm 错误!错误号 ECONNRESET
> npm 错误!网络在尝试获取 https://registry.npmjs.org/@material%2ftab-bar 时,出现无效的响应主体:已中止 @material%2ftab-bar 的获取:已中止
> npm 错误!网络这是与网络连接相关的问题。
> npm 错误!网络在大多数情况下,您可能在代理后面或者网络设置不佳。
> npm 错误!网络
> npm 错误!网络如果您在代理后面,请确保
> npm 错误!网络 'proxy' 配置已正确设置。 请参见:'npm help config'
> ocal\npm-cache_logs\2023-07-27T10_40_18_833Z-debug
> npm 错误!此运行的完整日志可以在以下位置找到:C:\Users\laptop\AppData\Local\npm-cache_logs\2023-07-27T10_40_18_833Z-debug-0.log
> ✖ 包安装失败,请参考上面的内容。

如何解决这个问题?

我检查了但找不到解决方案。具体来说,这是我使用Angular的第一周。

英文:

I use the following version on my working Windows Laptop.

  • Angular CLI: 9.1.15
  • Node: 16.16.0
  • OS: win32 x64
  • Windows 10

When I add Angular Material using ng add @angular/material using this command that run well.

After I let installing, It shows following error.

> The package @angular/material@16.1.5 will be installed and executed.
> Would you like to proceed? Yes
> npm WARN config global --global, --local are deprecated. Use --location=global instead.
> npm ERR! code ECONNRESET
> npm ERR! errno ECONNRESET
> npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/@material%2ftab-bar: abortedg/@material%2ftab-bar: aborted
> 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
> 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'
> ocal\npm-cache_logs\2023-07-27T10_40_18_833Z-deb
> npm ERR! A complete log of this run can be found in: C:\Users\laptop\AppData\Local\npm-cache_logs\2023-07-27T10_40_18_833Z-debug-0.log
> ✖ Packages installation failed, see above.

How to solve that problem?

I checked and I couldn't find solution. Specifically this is my first week with Angular.

答案1

得分: 0

我修复了问题。谢谢。

  • 这很简单
    运行,在你的终端上运行 npm cache clear --force

  • 再次添加 Angular Material

英文:

I fixed the problem. Thank you.

  • it's very simple

run, npm cache clear --force on your terminal.

  • Add Angular Material again

huangapple
  • 本文由 发表于 2023年7月27日 18:53:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/76779030.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定