包管理器控制台挂在 npm init 上

Package Manager Console hangs on npm init

所以我正在尝试 运行 在 NuGet 中安装一个基本的 npm,当我 运行 'npm init' 它在到达这里后立即挂起:

This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.

此时它不会响应任何命令,^C什么也不做。

我试过重新安装 npm,更新 npm,关闭并重新打开 Visual Studio 2019,没有骰子。 我能找到的所有帮助都说这是几年前的问题,但解决方法是恢复最近的 npm 更新或只是等待新版本发布,所以我不确定为什么我会看到它在 2020 年。

我能够使用 'npm init -y' 安装我的 package.json,所以我不认为这会损害我的项目,但我仍然想确保没有任何完全错误我的设置

Package Manager Console hangs on npm init

问题至今未解决

事实上,这是 已知 NuGet 包管理器控制台 本身的问题。

它的主要功能是为您的项目管理 (install/change/uninstall/etc.) 个 NuGet 程序包,它意味着 运行 PowerShell 命令。而且它只是部分集成,因此对于外部 npm 工具,它不能像完整的 Powershell 那样完美地工作。

我已将此帖子报告给 DC 论坛,以将此问题反映给相关人员。 here 就是 link。遇到相同问题的朋友可以在这里投票,你也可以在link中添加任何详细的评论,这将引起微软的高度重视。

由于该过程可能需要很多时间,作为解决方法,您可以尝试我的建议:

1) 通过菜单 Tools-->Command Line-->[=14= 使用外部 Powershell 而不是 Nuget Package Console ].

希望对您有所帮助。