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

Meteor install with npm install -g meteor fail with 403 error

按照其官方网站上的说明使用命令“npm install -g meteor”安装 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。如果返回restricted,执行下面的- Set-ExecutionPolicy AllSigned or Set-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

可以找到 Chocolatey Install 的来源 here