微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用 npm install -g 流星安装流星失败并出现 403 错误

如何解决使用 npm install -g 流星安装流星失败并出现 403 错误

按照官方网站上的说明使用命令“npm install -gmeteor”安装meteor,https://www.meteor.com/developers/install会出现以下错误

os
 win 10 pro
node -v
 v14.15.1
npm -v
 6.14.8

它给出了这个错误

Downloading |░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░| 0%events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: Response status was 403
    at ClientRequest.<anonymous> (C:\Users\Jefferson\AppData\Roaming\npm\node_modules\meteor\node_modules\node-downloader-helper\dist\index.js:1:7153)
    at Object.onceWrapper (events.js:422:26)
    at ClientRequest.emit (events.js:315:20)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:641:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
    at TLSSocket.socketonData (_http_client.js:509:22)
    at TLSSocket.emit (events.js:315:20)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:284:9)
    at TLSSocket.Readable.push (_stream_readable.js:223:10)
Emitted 'error' event on b instance at:
    at ClientRequest.<anonymous> (C:\Users\Jefferson\AppData\Roaming\npm\node_modules\meteor\node_modules\node-downloader-helper\dist\index.js:1:7284)
    at Object.onceWrapper (events.js:422:26)
    [... lines matching original stack trace ...]
    at TLSSocket.Readable.push (_stream_readable.js:223:10) {
  status: 403,body: ''
}
+ meteor@2.2.0
added 46 packages from 25 contributors in 16.461s

解决方法

不幸的是遇到了同样的错误。也尝试使用管理员权限安装它,但失败了。

我用来在 Windows 上安装它的另一种方法是使用 Chocolatey。

步骤如下

a) 以管理员身份打开 PowerShell

b) 运行 Get-ExecutionPolicy。如果返回受限,请执行以下操作 - Set-ExecutionPolicy AllSignedSet-ExecutionPolicy Bypass -Scope Process

c) 运行此命令 Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

d) 安装完成后。写入 choco 以检查是否实际安装。

e) 执行以下命令 choco install meteor

可以在 here 中找到 Chocolatey 安装的来源。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。