npm error ENOENT: no such file or directory, open '/app/package.json'
austindelic
HOBBYOP

a month ago

I’m deploying a monorepo on Railway using Railpack.

Web app lives at /apps/web

Railway Root Directory is set to /apps/web

/apps/web has its own package.json

Build fails with:

npm error ENOENT: no such file or directory, open '/app/package.json'
My go api is deploying just find with the exact same setup.
No env variables messing with anything, cant seem to debug the issue, any help would be appreciated!

Solved$10 Bounty

Pinned Solution

darseen
HOBBYTop 5% Contributor

a month ago

In an npm monorepo, the Root Directory should be set to / or left empty (you can find it in your service settings). And you should use a custom Build/Start Command for your web app.

If you are using npm workspaces for example, your commands would be:
Build Command: npm run build -w apps/web
Start Command: npm start -w apps/web

Your go API is self contained, thus it works fine. But your web app's dependecies should be installed from the root directory of your monorepo.

2 Replies

darseen
HOBBYTop 5% Contributor

a month ago

In an npm monorepo, the Root Directory should be set to / or left empty (you can find it in your service settings). And you should use a custom Build/Start Command for your web app.

If you are using npm workspaces for example, your commands would be:
Build Command: npm run build -w apps/web
Start Command: npm start -w apps/web

Your go API is self contained, thus it works fine. But your web app's dependecies should be installed from the root directory of your monorepo.


darseen

In an npm monorepo, the Root Directory should be set to / or left empty (you can find it in your service settings). And you should use a custom Build/Start Command for your web app.If you are using npm workspaces for example, your commands would be:Build Command: npm run build -w apps/webStart Command: npm start -w apps/webYour go API is self contained, thus it works fine. But your web app's dependecies should be installed from the root directory of your monorepo.

austindelic
HOBBYOP

a month ago

Works perfectly, thanks!


Status changed to Solved uxuz about 1 month ago


Loading...