Angular:创建项目时,NPM安装卡住不动。

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

Angular: NPM installation stalls out when creating project

问题

我刚刚尝试创建一个新项目,但出现了安装Node包的问题。当我安装Angular的v16版本时,我遇到了相同的问题,但最终通过安装最新版本的Typescript来解决了它。

截止到目前,我有:

Node 18.16.0

NPM 7.21.0

Angular 16.1.3

Typescript 5.1.6

Windows 10 64位

我尝试运行ng new my-app --standalone,但它卡在那里超过了20分钟。我再次尝试不使用standalone标志,但结果相同。我运行了npm cache clean --force然后再次尝试。我尝试使用--skip-install标志生成应用程序以分开运行npm install,但它只停留在sill idealtree builddeps上。我找到了一个解决方案,说要删除package-lock.json文件,然后尝试运行npm install,但应用程序中没有package-lock.json文件。我找到了几篇关于这个问题的文章,它们都提供了一些似乎不能解决问题的相同解决方案。有人知道为什么会发生这种情况吗?

英文:

I just tried to create a new project and its for some reason getting hung up on installing the node packages. I had this same problem when I installed v16 of Angular but I wound up fixing it by installing the latest version of Typescript.

As of right now I have:

Node 18.16.0

NPM 7.21.0

Angular 16.1.3

Typescript 5.1.6

Windows 10 64bit

I tried running ng new my-app --standalone and it got hung up for over 20 minutes. I tried it again without the standalone flag and the same thing happened. I ran npm cache clean --force and tried again. I tried generating the app with the --skip-install flag to run npm install separately and it didn't do anything but stay stuck on sill idealtree builddeps. I came across a solution that said to delete the package-lock.json file and try running npm install however there was no package-lock.json file in the app. I've come across several articles on this issue and they all provide the same handful of solutions that don't seem to resolve the problem. Does anybody know why this might be happening?

答案1

得分: 1

这与这个问题 https://github.com/npm/cli/issues/3257 有关。

这是关于 npm v7 和 v8 的版本。
所以将 npm 升级到更高版本(推荐 9.5.1)。

我成功尝试了这个命令

ng new my-app --standalone

在这个环境下:

  • Angular CLI:16.2.0
  • Node:18.16.0
  • 包管理器:npm 9.5.1
  • 操作系统:win32 x64
英文:

It is related to this issue https://github.com/npm/cli/issues/3257.

It is about version of npm v7 and v8
So upgrade npm to higher version (recommend 9.5.1),

I try this command successfully

ng new my-app --standalone

with this environment:

  • Angular CLI: 16.2.0
  • Node: 18.16.0
  • Package Manager: npm 9.5.1
  • OS: win32 x64

huangapple
  • 本文由 发表于 2023年8月10日 09:47:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/76872164.html
匿名

发表评论

匿名网友

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

确定