在 Node js 上安装必要的包时出错

新手上路,请多包涵

我在 Windows 上安装 Node.js。它安装成功,我还在 node.js 安装程序中选择了安装必要文件(例如巧克力)的选项。 node安装好后,打开Powershell;安装一段时间后,我收到此错误:

 # A lot of logs before, just an excerpt
 Microsoft.VisualStudio.Workload.VCTools Microsoft.VisualStudio.Component.Roslyn.Compiler Microsoft.Component.MSBuild Microsoft.VisualStudio.Component.CoreBuildTools Microsoft.VisualStudio.Component.Windows10SDK Microsoft.VisualStudio.Component.VC.CoreBuildTools Microsoft.VisualStudio.Component.Static.Analysis.Tools Microsoft.VisualStudio.Component.VC.Tools.x86.x64 Microsoft.VisualStudio.Component.VC.Redist.14.Latest Microsoft.VisualStudio.Component.Windows10SDK.17763 Microsoft.VisualStudio.Component.VC.CMake.Project Microsoft.VisualStudio.Component.TestTools.BuildTools
[5330:000f][2021-04-19T18:24:09] Decorating UnelevatedProductModifier with UnelevatedInstallerTelemetryDecorator
[5330:000f][2021-04-19T18:24:09] Created a UnelevatedInstallerTelemetryDecorator
[5330:000e][2021-04-19T18:24:09] Download requested: https://aka.ms/vs/15/release/channel
[5330:001d][2021-04-19T18:24:09] Attempting download 'https://aka.ms/vs/15/release/channel' using engine 'WebClient'
[5330:001d][2021-04-19T18:24:09] WebClient error 'RequestCanceled' with 'https://aka.ms/vs/15/release/channel' - GetWebResponse failed along with a cancellation request
[5330:001d][2021-04-19T18:24:09] Error 0x8013153b: [5330:001d][2021-04-19T18:24:09] Could not update channel "https://aka.ms/vs/15/release/channel"
   at System.Threading.CancellationToken.ThrowOperationCanceledException()
   at System.Threading.CancellationToken.ThrowIfCancellationRequested()
   at Microsoft.VisualStudio.Setup.Download.WebClientEngine.GetWebResponse(Uri uri, DownloadContext downloadContext, DownloadSummary& downloadSummary, HttpWebRequest& webRequest, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Setup.Download.WebClientEngine.DownloadCore(Uri uri, Stream stream, ProgressUpdateCallback progress, CancellationToken cancellationToken, DownloadContext downloadContext, ITelemetryOperation telemetryOperation)
   at Microsoft.VisualStudio.Setup.Download.DownloadEngineBase.DownloadWithBitRate(Uri uri, Stream outputStream, ProgressUpdateCallback progress, CancellationToken cancellationToken, DownloadContext downloadContext, ITelemetryOperation telemetryOperation)
   at Microsoft.VisualStudio.Setup.Download.DownloadEngineBase.Download(Uri uri, Stream outputStream, ProgressUpdateCallback progress, CancellationToken cancellationToken, DownloadContext downloadContext, ITelemetryOperation telemetryOperation)
   at Microsoft.VisualStudio.Setup.Download.DownloadManager.DownloadWithRetry(IDownloadEngine[] engines, Uri uri, Stream outputStream, ProgressUpdateCallback progress, CancellationToken cancellationToken, DownloadContext downloadContext, Boolean verifySignature)
   at Microsoft.VisualStudio.Setup.Download.DownloadManager.<>c__DisplayClass23_0.<Download>b__0()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Setup.ChannelManager.<GetLatestChannelManifestAsync>d__85.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Setup.ChannelManager.<UpdateChannelManifestAsync>d__77.MoveNext()

没有其他事情发生。我该怎么办?

原文由 code 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 1.4k
1 个回答

附加工具会安装许多项目及其依赖项,如在执行脚本时提到的那样。如果需要使用这些工具编译任何节点模块,将使用这些项目。

此脚本将安装 Python 和 Visual Studio 构建工具,这是编译 Node.js 本机模块所必需的。请注意,还将安装 Chocolatey 和所需的 Windows 更新。

这将需要大约 3 Gb 的可用磁盘空间,以及安装 Windows 更新所需的任何空间。这将需要一段时间才能运行。

node-v16.13.0-x64.msi 示例

- https://chocolatey.org/packages/chocolatey
- https://chocolatey.org/packages/python
- https://chocolatey.org/packages/visualstudio2019-workload-vctools

特别是 visualstudio2019-workload-vctools 涉及下载 1.6 gig 构建工具,这可能需要一段时间。

如果您想知道事情是否有进展,请尝试启动 Visual Studio 安装程序。如果它仍在运行,您可能会收到一条消息,指出“此实例正在运行时无法启动安装程序的另一个实例”。

如果您已经退出、重新启动并重新启动脚本,但您仍然想知道是否所有工具都已安装,您可以执行以下操作:

  • Type choco list -lo to see if the packages visualstudio-installer , visualstudio2019-workload-vctools , and visualstudio2019buildtools are installed
  • 打开 Visual Studio Installer ,可以看到安装器是否已经完成构建工具的安装。它可能需要恢复。 Visual Studio 安装程序进度

原文由 jtessier72 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题