monorepo ENOENT: no such file or directory, open '/app/package.json'
poyel
FREEOP

17 days ago

Hi all,

i'm new to railways, nice to meet you.

I'm trying to deploy a monorepo application project, but i have the error written in the title.

The project folder is structured in this way:

root project:

-- frontend (angular application)

-- backend-go

I have configured railpack.json inside the frontend folder, this to configure the install command.

This is the railpack.json.

{

"$schema": "https://schema.railpack.com",

"steps": {

"install": {

  "commands": ["npm install --legacy-peer-deps"]

},

"build": {

  "inputs": [{ "step": "install" }],

  "commands": ["npm run build"]

}

}

}

and i have add /frontend as root project.

Any help is appreciated.

Thanks,

Marco

Awaiting Conductor Response$10 Bounty

7 Replies

Railway
BOT

17 days ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway • 17 days ago


andywithcamera
HOBBYTop 10% Contributor

17 days ago

Heya. Your package.json might not be loading. Is it in your project root? Also, any reason you didn’t create these as separate services?


andywithcamera

Heya. Your package.json might not be loading. Is it in your project root? Also, any reason you didn’t create these as separate services?

poyel
FREEOP

17 days ago

Hey,

yes i've created 2 services one for the frontend and one for the backend, each one as setted the proper root directory in the settings tab of the service.

The package.json file is inside the frontend folder as the railpack.json file.

I'm attacching the log file

Attachments


poyel

Hey, yes i've created 2 services one for the frontend and one for the backend, each one as setted the proper root directory in the settings tab of the service. The package.json file is inside the frontend folder as the railpack.json file. I'm attacching the log file

zotilrk
HOBBY

17 days ago

Hi, I have a monorepo project too, this seems that you don't have the package.json in the right directory.

this is a SS from mi package.json, it is on my frontend root directory.

image.png

Attachments


andywithcamera
HOBBYTop 10% Contributor

17 days ago

So it found package-lock.json but not package.json. Is package.json committed to git? Is it blocked by .gitignore or named incorrectly perhaps? Maybe try running ‘git add frontend/package.json’ and pushing.


poyel
FREEOP

16 days ago

Hi All,

i tried all solution without any success.

But i found this github issue https://github.com/railwayapp/railpack/issues/211 that describe exactly the same issue.

Now i remove the install step command but the issue now is the npm install. I want to use a custom npm install command, but i am not able to find the right way now.


poyel
FREEOP

16 days ago

I found the solution setting RAILPACK_INSTALL_CMD as env variable and set the right command to execute.

The build was fine at the end 🙂


andywithcamera
HOBBYTop 10% Contributor

15 days ago

Nice one. Glad you got sorted.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...