railwayapp / nixpacks

App source + Nix packages + Docker = Image
https://nixpacks.com
MIT License
2.47k stars 232 forks source link

Install NodeJS if Bun is used #971

Closed coffee-cup closed 11 months ago

coffee-cup commented 11 months ago

Feature request

Some packages still require NodeJS to be installed so we can't rely on a Bun only install. It is also common to build/test with Bun but then run with NodeJS. If Bun is detected, we should also install and setup NodeJS so that it can be used as well.

Motivation

No response

Contribution

No response

Milo123459 commented 11 months ago

does this literally just require installing node and npm at the same time?

sinasab commented 11 months ago

I stumbled upon this issue, figured I'd communicate my usecase in case it adds useful context. I have some typescript code, for which I manage packages and build it into a .mjs file with Bun, but I want to actually run that build output with node.

Currently I have to massage my railway/nixpacks configs to make this work. It'd be really useful for cases like this if either node came default bundled in with Bun, or if there was an easy option to set to include it.

For anyone else who comes across this, I managed to get it working by adding this to my nixpacks.toml at the root of my project, though there may be a better solution:

[phases.install]
nixPkgs = ["nodejs_20"]