hashicorp / terraform-cdk

Define infrastructure resources using programming constructs and provision them using HashiCorp Terraform
https://www.terraform.io/cdktf
Mozilla Public License 2.0
4.79k stars 441 forks source link

Prebuild binary missing for platform linux #3641

Open Rom888 opened 1 month ago

Rom888 commented 1 month ago

Expected Behavior

No error

Actual Behavior

pnpm add --global cdktf-cli@0.20.7

 WARN  6 deprecated subdependencies found: coffee-script@1.12.7, har-validator@5.1.5, request@2.88.2, sourcemap-codec@1.4.8, uuid@3.4.0, xlsjs@0.7.6
Packages: +260
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 1069, reused 1068, downloaded 0, added 0, done
.pnpm/@cdktf+node-pty-prebuilt-multiarch@0.10.1-pre.11/node_modules/@cdktf/node-.pnpm/@cdktf+node-pty-prebuilt-multiarch@0.10.1-pre.11/node_modules/@cdktf/node-pty-prebuilt-multiarch: Running install script, failed in 554ms
.../@cdktf/node-pty-prebuilt-multiarch install$ node scripts/check-prebuild.j…
│ Prebuild binary missing for platform linux
│ prebuild-install warn install No prebuilt binaries found (target=22.2.0 run…
│ node:events:498
│       throw er; // Unhandled 'error' event
│       ^
│ Error: spawn node-gyp ENOENT
│     at ChildProcess._handle.onexit (node:internal/child_process:286:19)
│     at onErrorNT (node:internal/child_process:484:16)
│     at process.processTicksAndRejections (node:internal/process/task_queues…
│ Emitted 'error' event on ChildProcess instance at:
│     at ChildProcess._handle.onexit (node:internal/child_process:292:12)
│     at onErrorNT (node:internal/child_process:484:16)
│     at process.processTicksAndRejections (node:internal/process/task_queues…
│   errno: -2,
│   code: 'ENOENT',
│   syscall: 'spawn node-gyp',
│   path: 'node-gyp',
│   spawnargs: [ 'rebuild' ]
│ }
│ Node.js v22.2.0
└─ Failed in 554ms at /home/rom/.local/share/pnpm/global/5/.pnpm/@cdktf+node-pty-prebuilt-multiarch@0.10.1-pre.11/node_modules/@cdktf/node-pty-prebuilt-multiarch
 ELIFECYCLE  Command failed with exit code 1.

Steps to Reproduce

pnpm add --global cdktf-cli@0.20.7

Versions

language: typescript cdktf-cli: 0.20.7 node: 22.2.0 terraform: 1.8.4 arch: amd64 os: ubuntu 23.10

Providers

No response

Gist

No response

Possible Solutions

No response

Workarounds

No response

Anything Else?

No response

References

No response

Help Wanted

Community Note

ansgarm commented 3 weeks ago

Hi @Rom888 👋

Thank you for raising this. It seems like you are using Node.js v22, for which we don't have prebuild bindings at this time at all in the cdktf/node-pty-prebuilt-multiarch library. The simplest fix would be to use Node.js v20 for the CDKTF CLI.

That said, the package should build the binaries during post-install as a fallback but it seems like pnpm didn't run the postinstall script? We don't officially support pnpm at this time, so you might need to adjust some settings for it or use npm to install the CDKTF CLI.