hapi icon indicating copy to clipboard operation
hapi copied to clipboard

linux无法安装

Open JuniverseCoder opened this issue 9 months ago • 7 comments

What version of HAPI is running?

0.15.4

What platform is your computer?

No response

What issue are you seeing?

Image

What steps can reproduce the bug?

npx @twsxtd/hapi hub

What is the expected behavior?

能正常安装

Additional information

No response

JuniverseCoder avatar Mar 01 '26 13:03 JuniverseCoder

从代码看,npx @twsxtd/hapi hub 会执行 cli/bin/hapi.cjs,它按 process.platform/process.arch 去查找平台包(例如 @twsxtd/hapi-linux-x64 / @twsxtd/hapi-linux-arm64)。找不到平台包时会直接报 Unsupported platform: ${platform}-${arch} 并提示去 Releases 手动下载。Linux 支持范围仅 linux-x64 / linux-arm64。

Relevant code:

  • cli/bin/hapi.cjs:9 - 计算平台包名并 require.resolve 查找
  • cli/bin/hapi.cjs:57 - 找不到平台包时报错与提示
  • cli/package.json:28 - 可选平台包列表

Need more info:

  • 你的架构输出:uname -m
  • 你的 Node/NPM 版本:node -v,npm -v
  • 终端完整报错文本(不要截图)
  • 你是否只用 npx,还是也试过全局安装 npm install -g @twsxtd/hapi

HAPI Bot

github-actions[bot] avatar Mar 01 '26 13:03 github-actions[bot]

还是有问题,应该是linux-x64打包的有问题,我直接解压的,还是报错:

[root@iZwz93znh2fcv3fiu4kosyZ hapi]# ll
total 211668
-rwxr-xr-x 1 1001 1001 148720549 Mar  1 11:06 hapi
-rwxr-xr-x 1 root root      4068 Mar  1 22:17 hapi-hubctl.sh
-rw-r--r-- 1 root root  67982703 Mar  1 22:22 hapi-linux-x64.tar.gz
drwxr-xr-x 2 root root      4096 Mar  1 21:09 log
drwxr-xr-x 3 root root      4096 Mar  1 21:39 node_modules
drwxr-xr-x 3 root root      4096 Mar  1 21:44 package
-rw-r--r-- 1 root root        51 Mar  1 21:39 package.json
-rw-r--r-- 1 root root       442 Mar  1 21:42 package-lock.json
drwxr-xr-x 2 root root      4096 Mar  1 22:19 run
-rw-r--r-- 1 root root      2298 Mar  1 21:44 twsxtd-hapi-0.15.4.tgz
[root@iZwz93znh2fcv3fiu4kosyZ hapi]# hapi
Unsupported platform: linux-x64

Supported platforms:
  - darwin-arm64 (macOS Apple Silicon)
  - darwin-x64 (macOS Intel)
  - linux-arm64
  - linux-x64
  - win32-x64

You can download the binary manually from:
  https://github.com/tiann/hapi/releases

JuniverseCoder avatar Mar 01 '26 13:03 JuniverseCoder

你可以试试先npm install @twsxtd/hapi 再npm install @twsxtd/hapi-linux-x64,两个命令都跑,这样应该就能装上 我当初是这样装的 可能打包确实有点小问题,我不太清楚这种现象是否符合预期

LiJinHao999 avatar Mar 01 '26 21:03 LiJinHao999

用npm我装不上,就是普通64为linux平台。但release的二进制包我可以正常用。

mathitme avatar Mar 01 '26 23:03 mathitme

试了一下,自己从源码编译的可以运行,从github release下载的二进制不行。 然后npm强行换成官方源的,就可以了,应该是打包的时候的问题吧。 npm install -g @twsxtd/hapi --registry=https://registry.npmjs.org/

JuniverseCoder avatar Mar 02 '26 00:03 JuniverseCoder

试了一下,自己从源码编译的可以运行,从github release下载的二进制不行。 然后npm强行换成官方源的,就可以了,应该是打包的时候的问题吧。 npm install -g @twsxtd/hapi --registry=https://registry.npmjs.org/

nice job

vulbox avatar Mar 02 '26 02:03 vulbox

原因是镜像源没有同步 plaform 的包,只同步了主包,已经优化了错误提示,感谢反馈! https://github.com/tiann/hapi/commit/673e0c8aec806847e3fb3b0844e2e70837588aa7

tiann avatar Mar 02 '26 04:03 tiann