Filad deploy
ray-pusan
FREEOP

2 months ago

Hi everyone, I’m trying to deploy my Node/Express + TypeScript project on Railway, but the build fails during the image build step. Locally, npm run build works fine with no errors, but Railway deployment stops with “Failed to build an image” and the logs show errors like Cannot use import statement outside a module or Error connecting to db: Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://" (I’m using ES modules with "module": "ES2020" in tsconfig and tsc build). I already added "type": "module" in package.json and checked imports/exports, but the issue persists. What is the correct Railway configuration for a TypeScript + Express project using ES modules, and how can I fix this build error?

0 Replies

Loading...