使用“1”个参数调用“DownloadString”时出现异常:“无法连接到远程服务器”

问题描述 投票:0回答:2

我刚刚开始使用以下命令在 Windows 10 上安装

NativeScript

@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://www.nativescript.org/setup/win'))"

我从这里的安装指南中获得https://docs.nativescript.org/angular/start/quick-setup

但是我收到此错误消息:

Exception calling "DownloadString" with "1" argument(s): "Unable to connect to the remote server"
At line:1 char:1
+ iex ((new-object net.webclient).DownloadString('https://www.nativescr ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : WebException


C:\Windows\system32>@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://www.nativescript.org/setup/win'))"
Exception calling "DownloadString" with "1" argument(s): "Unable to connect to the remote server"
At line:1 char:1
+ iex ((new-object net.webclient).DownloadString('https://www.nativescr ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : WebException

问题是什么以及如何解决?

installation windows-10 runtime-error nativescript
2个回答
2
投票

以下步骤对我有用:

  1. 从 URL (https://www.nativescript.org/setup/win) 下载文件。
  2. 以管理员身份运行cmd并cd到下载文件的目录。
  3. 在cmd中执行以下命令:
    powershell -noexit "& ""./native-script.ps1"""

0
投票

在 PS 5.1.1 中遇到此问题。

安装了 Powershell 7,再次运行巧克力安装 - 成功。

© www.soinside.com 2019 - 2024. All rights reserved.