mscdex / ssh2

SSH2 client and server modules written in pure JavaScript for node.js
MIT License
5.5k stars 665 forks source link

how to fix cpu-features node-gyp build in docker FROM alpine:latest? env: Customized version of AMD 128-core CPU... #1407

Closed gowy222 closed 3 weeks ago

gowy222 commented 1 month ago
24-07-25 15:05:01] #9 7.561 .../node_modules/cpu-features install$ node buildcheck.js > buildcheck.gypi && node-gyp rebuild
[2024-07-25 15:05:01] #9 7.619 .../node_modules/cpu-features install: /node/app/node_modules/.pnpm/buildcheck@0.0.6/node_modules/buildcheck/lib/index.js:115
[2024-07-25 15:05:01] #9 7.620 .../node_modules/cpu-features install:   throw new Error('Unable to detect compiler type');
[2024-07-25 15:05:01] #9 7.622 .../node_modules/cpu-features install:   ^
[2024-07-25 15:05:01] #9 7.623 .../node_modules/cpu-features install: Error: Unable to detect compiler type
[2024-07-25 15:05:01] #9 7.624 .../node_modules/cpu-features install:     at BuildEnvironment.getKind (/node/app/node_modules/.pnpm/buildcheck@0.0.6/node_modules/buildcheck/lib/index.js:115:9)
[2024-07-25 15:05:01] #9 7.624 .../node_modules/cpu-features install:     at BuildEnvironment.tryCompile (/node/app/node_modules/.pnpm/buildcheck@0.0.6/node_modules/buildcheck/lib/index.js:537:15)
[2024-07-25 15:05:01] #9 7.624 .../node_modules/cpu-features install:     at BuildEnvironment.checkHeader (/node/app/node_modules/.pnpm/buildcheck@0.0.6/node_modules/buildcheck/lib/index.js:423:25)
[2024-07-25 15:05:01] #9 7.625 .../node_modules/cpu-features install:     at Object.<anonymous> (/node/app/node_modules/.pnpm/cpu-features@0.0.10/node_modules/cpu-features/buildcheck.js:16:4)
[2024-07-25 15:05:01] #9 7.625 .../node_modules/cpu-features install:     at Module._compile (node:internal/modules/cjs/loader:1358:14)
[2024-07-25 15:05:01] #9 7.625 .../node_modules/cpu-features install:     at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
[2024-07-25 15:05:01] #9 7.626 .../node_modules/cpu-features install:     at Module.load (node:internal/modules/cjs/loader:1208:32)
[2024-07-25 15:05:01] #9 7.626 .../node_modules/cpu-features install:     at Module._load (node:internal/modules/cjs/loader:1024:12)
[2024-07-25 15:05:01] #9 7.626 .../node_modules/cpu-features install:     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
[2024-07-25 15:05:01] #9 7.627 .../node_modules/cpu-features install:     at node:internal/main/run_main_module:28:49
[2024-07-25 15:05:01] #9 7.627 .../node_modules/cpu-features install: Node.js v20.15.1
[2024-07-25 15:05:01] #9 7.629 .../node_modules/cpu-features install: Failed
[2024-07-25 15:05:01] #9 7.633 .../.pnpm/ssh2@1.15.0/node_modules/ssh2 install$ node install.js
[2024-07-25 15:05:01] #9 7.678 .../.pnpm/ssh2@1.15.0/node_modules/ssh2 install: /bin/sh: node-gyp: not found
[2024-07-25 15:05:01] #9 7.682 .../.pnpm/ssh2@1.15.0/node_modules/ssh2 install: Failed to build optional crypto binding
[2024-07-25 15:05:01] #9 7.688 .../.pnpm/ssh2@1.15.0/node_modules/ssh2 install: Done
mscdex commented 1 month ago

ssh2 should still be usable, but if you want to fix these errors (whether for cpu-features or any other compiled node.js addon) you will need to have node-gyp and a c/c++ compiler installed. npm bundles node-gyp so this is usually not a problem. I guess pnpm does not.