a year ago
In the new release of bun, with isolated installs. I started having issues with optional specific dependencies (OS related), since I can't customize the install script, I need to manually add them. It would be good if railway passed those info to bun install (via os and arch options) or allow us to pass it ourselves.
61 Replies
a year ago
You can install dependencies with environmental variables! Check out the build variables: https://railpack.com/config/environment-variables/#build-configuration
a year ago
for some reason, even forcing this, is not allowing bun to recognize it as a dependency, this is the deployment:
a year ago
I can't view your deployments. Can you share the error and logs?
a year ago
sure thing
a year ago
Bun v1.3.0 (Linux x64 baseline)
error: "react-router-serve" exited with code 1
error: script "start" exited with code 1
error: script "start" exited with code 1
$ cd ./apps/app && bun start
$ bun --bun react-router-serve ./build/server/index.js
80871 | }
80872 | help.push(
80873 | "- Consult the installation documentation:",
80874 | " See https://sharp.pixelplumbing.com/install"
80875 | );
80876 | throw new Error(help.join("\n"));
^
error: Could not load the "sharp" module using the linux-x64 runtime
undefined: Could not dynamically require "../src/build/Release/sharp-linux-x64.node". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.a year ago
undefined: Could not dynamically require "../src/build/Release/sharp-wasm32.node". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.
undefined: Could not dynamically require "@img/sharp-linux-x64/sharp.node". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.
undefined: Could not dynamically require "@img/sharp-wasm32/sharp.node". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.
Possible solutions:
- Ensure optional dependencies can be installed:
npm install --include=optional sharp
- Ensure your package manager supports multi-platform installation:
See https://sharp.pixelplumbing.com/install#cross-platform
- Add platform-specific dependencies:
npm install --os=linux --cpu=x64 sharp
- Consult the installation documentation:
See https://sharp.pixelplumbing.com/install
at requireSharp (/app/apps/app/build/server/assets/server-build-IAOUVDo1.js:80876:15)
at requireConstructor (/app/apps/app/build/server/assets/server-build-IAOUVDo1.js:80888:3)
at requireLib (/app/apps/app/build/server/assets/server-build-IAOUVDo1.js:85323:17)
at /app/apps/app/build/server/assets/server-build-IAOUVDo1.js:85335:18
Bun v1.3.0 (Linux x64 baseline)
error: "react-router-serve" exited with code 1
error: script "start" exited with code 1
error: script "start" exited with code 1a year ago
I am running a custom install command: bun install --os "*" --cpu "*"
a year ago
Is this project open source?
a year ago
sadly no
a year ago
This happens during deployment I assume?
a year ago
yes, it works locally with the same commands that I run on railway, so I dont know whats the difference here
a year ago
it builds and it deploys, but when it tries to run (deploy logs), it happens those errors
a year ago
{
"name": "@repo/domains",
"version": "1.0.0",
"private": true,
"type": "module",
"exports": {
".": "./src/domains/index.ts",
"./*": "./src/domains/*/index.ts",
"./server": "./src/server.ts",
"./utils/*": "./src/utils/*.ts"
},
"license": "MIT",
"scripts": {
"verify": "biome check --error-on-warnings ./src",
"db": "bun --bun --env-file=../../.env --env-file=../../.env.local drizzle-kit",
"test": "bun test"
},
"devDependencies": {
"@faker-js/faker": "^10.0.0",
"@types/cookie": "^1.0.0",
"@types/react": "catalog:react",
"@types/three": "catalog:3d",
"drizzle-kit": "^0.31.5",
"typescript": "catalog:general"
},
"dependencies": {
"@gltf-transform/core": "^4.2.1",
"@gltf-transform/extensions": "^4.2.1",
"@gltf-transform/functions": "^4.2.1",
"@img/sharp-linux-x64": "^0.34.4",
"drizzle-cuid2": "2.1.0",
"drizzle-orm": "^0.44.6",
"gltf-validator": "^2.0.0-dev.3.10",
"lucide-react": "catalog:react",
"meshoptimizer": "^0.25.0",
"react": "catalog:react",
"react-router": "catalog:react",
"sharp": "^0.34.4"
}
}a year ago
Have you tried using bun install --include=optional --force --os=linux --cpu=x64
And what variable are you using to set this?
a year ago
env var: RAILPACK_INSTALL_CMD
a year ago
deploying new changes to see if it work
a year ago
@Sam (Loudbook) same error sadly
a year ago
<:sadJoe:828937686026158100>
a year ago
I am starting to wonder if its an railway issue, because its building and deploying locally with no issues
a year ago
Less Railway issue more just running in an isolated environment issue
a year ago
I would expect it to happen in any VM
a year ago
hm, maybe if I add it as a global dependency or a root one?
a year ago
Let's just try one modification of that command I sent earlier just to make sure
a year ago
1 sec
a year ago
Just add the word sharp to the end of it
a year ago
bun install --include=optional --force --os=linux --cpu=x64 sharp
a year ago
running it
a year ago
Or wait it probably gets removed when it goes into the runtime container...
a year ago
Hold on
a year ago
If that doesn't work try changing your start command to
bun add sharp --force --include=optional --os=linux --cpu=x64 && bun starta year ago
it looks like that worked
a year ago
i got an error from a different package
a year ago
What's that package now 👀
a year ago
draco3d
a year ago
Can you share the new error
a year ago
Aborted(Error: ENOENT: no such file or directory, open '/app/apps/app/build/server/assets/draco_decoder.wasm')
Aborted(Error: ENOENT: no such file or directory, open '/app/apps/app/build/server/assets/draco_encoder.wasm')
failed to asynchronously prepare wasm: RuntimeError: Aborted(Error: ENOENT: no such file or directory, open '/app/apps/app/build/server/assets/draco_decoder.wasm'). Build with -sASSERTIONS for more info.
Aborted(RuntimeError: Aborted(Error: ENOENT: no such file or directory, open '/app/apps/app/build/server/assets/draco_decoder.wasm'). Build with -sASSERTIONS for more info.)
failed to asynchronously prepare wasm: RuntimeError: Aborted(Error: ENOENT: no such file or directory, open '/app/apps/app/build/server/assets/draco_encoder.wasm'). Build with -sASSERTIONS for more info.
Aborted(RuntimeError: Aborted(Error: ENOENT: no such file or directory, open '/app/apps/app/build/server/assets/draco_encoder.wasm'). Build with -sASSERTIONS for more info.)
80896 | function f2(e) {
80897 | if (a.onAbort) a.onAbort(e);
80898 | e = "Aborted(" + e + ")";
80899 | da(e);
80900 | wa = true;
80901 | e = new WebAssembly.RuntimeError(e + ". Build with -sASSERTIONS for more info.");
^
RuntimeError: Aborted(Error: ENOENT: no such file or directory, open '/app/apps/app/build/server/assets/draco_decoder.wasm'). Build with -sASSERTIONS for more info.
at f2 (/app/apps/app/build/server/assets/server-build-CYEA_q8Q.js:80901:15)
at q (/app/apps/app/build/server/assets/server-build-CYEA_q8Q.js:80911:13)a year ago
everything was working fine on bun 1.2.23
a year ago
this is so annoying
a year ago
bun install --include=optional --force --os=linux --cpu=x64 sharp draco3d
a year ago
Try it!
a year ago
is there a way to do this through package.json? I hate messing with something platform specific
a year ago
that worked!
a year ago
Unfortunately I don't see a way to modify the install command in package json
a year ago
Yay!
a year ago
But honestly the method you just did should be fine- the issue may not be present on other platforms.
a year ago
do you think there's any chance railway will allow us to customize install command through the settings page instead of a env var?
a year ago
Doubt it
a year ago
But you're using the UI to set the variable- right?
a year ago
Not using a .env file?
a year ago
yeah, saw the recommendation through this message
a year ago
If you're putting it in the variables tab then it's in the right place

a year ago
but its kinda missleading, because the dependencies installed are for mises, not node/npm/bun
a year ago
¯_(ツ)_/¯
a year ago
You can modify the docs and make a pull request if you'd like
a year ago
I can't speak on the specifics of the Node install process. I pretty much just fed you google search results.
a year ago
the issue was the bot answer actually
a year ago
but I think I could also put it in the railpack.json file:
a year ago
it allows for a custom command for install too
a year ago
anyway, thanks for the help!
a year ago
Oh sorry. I didn't even read that.
a year ago
No problem!
Status changed to Open brody • 12 months ago
Status changed to Solved brody • 12 months ago