云网牛站
所在位置:首页 > HarmonyOS问题与回答 > 安装hpm命令行工具出现请求https://registry.npmjs.org/@ohos%2fhpm-cli失败

安装hpm命令行工具出现请求https://registry.npmjs.org/@ohos%2fhpm-cli失败

2021-06-21 17:44:53作者:wwwunix稿源:HarmonyOS站

问题:在安装hpm命令行工具时出错,提示error request to https://registry.npmjs.org/@ohos%2fhpm-cli failed等信息。当前网络环境没有任何限制,就是家用网络,也没有代理。

安装hpm命令行工具出现请求https://registry.npmjs.org/@ohos%2fhpm-cli失败

 

问题追加:

在ubuntu上运行:

npm install -g @ohos/hpm-cli

结果报错如下:

0 info it worked if it ends with ok

1 verbose cli [

1 verbose cli   '/home/wwwunix/Harmony/install/node-v14.15.1-linux-x64/bin/node',

1 verbose cli   '/usr/bin/npm',

1 verbose cli   'install',

1 verbose cli   '-g',

1 verbose cli   '@ohos/hpm-cli'

1 verbose cli ]

2 info using npm@6.14.8

3 info using node@v14.15.1

4 verbose npm-session eda43ac78d6c8e0e

5 silly install loadCurrentTree

6 silly install readGlobalPackageData

7 silly fetchPackageMetaData error for @ohos/hpm-cli@latest request to https://registry.npmjs.org/@ohos%2fhpm-cli failed, reason: connect ENETUNREACH 2606:4700::6810:1523:443 - Local (:::0)

8 timing stage:rollbackFailedOptional Completed in 2ms

9 timing stage:runTopLevelLifecycles Completed in 64ms

10 verbose type system

11 verbose stack FetchError: request to https://registry.npmjs.org/@ohos%2fhpm-cli failed, reason: connect ENETUNREACH 2606:4700::6810:1523:443 - Local (:::0)

11 verbose stack     at ClientRequest.<anonymous> (/home/wwwunix/Harmony/install/node-v14.15.1-linux-x64/lib/node_modules/npm/node_modules/node-fetch-npm/src/index.js:68:14)

11 verbose stack     at ClientRequest.emit (events.js:315:20)

11 verbose stack     at TLSSocket.socketErrorListener (_http_client.js:469:9)

11 verbose stack     at TLSSocket.emit (events.js:315:20)

11 verbose stack     at emitErrorNT (internal/streams/destroy.js:106:8)

11 verbose stack     at emitErrorCloseNT (internal/streams/destroy.js:74:3)

11 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:80:21)

12 verbose cwd /home/wwwunix/Harmony/install

13 verbose Linux 5.8.0-55-generic

14 verbose argv "/home/wwwunix/Harmony/install/node-v14.15.1-linux-x64/bin/node" "/usr/bin/npm" "install" "-g" "@ohos/hpm-cli"

15 verbose node v14.15.1

16 verbose npm  v6.14.8

17 error code ENETUNREACH

18 error errno ENETUNREACH

19 error request to https://registry.npmjs.org/@ohos%2fhpm-cli failed, reason: connect ENETUNREACH 2606:4700::6810:1523:443 - Local (:::0)

20 verbose exit [ 1, true ]

 

回答:

如果确定操作及环境无误,可以网络和系统环境不要做任何变化,换个时间再重新执行一下这条命令试试。

如果没有报任何错误,则多数是远程服务器端的问题,或者就是互联网到服务器之间出了问题。

精选文章
热门文章