pnpm workspace package not found
eyenalxai
PROOP

a month ago

Trying to switch from docker images to railpack, but I get this:

 ERR_PNPM_WORKSPACE_PKG_NOT_FOUND  In : "@phaephe/typescript-config@workspace:*" is in the dependencies but no package named "@phaephe/typescript-config" is present in the workspace
This error happened while installing a direct dependency of /app/web

Web app is in /app/web
Config is in /packages/typescript-config

Root Directory is set to /app/web

I'm using pnpm workspaces. What to do? I really don't want to have a ton of build/start commands in the root of my repo.

UPD: nvm i kinda figured it out by not setting a root directory and just using commands like pnpm --filter=@phaephe/web run start.

0 Replies

iloveitaly
HOBBY

a month ago

@Dark Empath Amogus we do want the default to work well here! I'm not super familiar with workspaces, what did you end up doing to fix it? Trying to determine if it's something we can improve on the railpack side to make the experience cleaner.


eyenalxai
PROOP

a month ago

I ended up not using Root Directory and instead created separate railway.json files for each service:

{
  "$schema": "https://railway.com/railway.schema.json",
  "build": {
    "buildCommand": "pnpm --filter=@phaephe/web run build",
    "watchPatterns": ["apps/web/**", "packages/**"]
  },
  "deploy": {
    "preDeployCommand": ["pnpm run db:migrate"],
    "startCommand": "pnpm --filter=@phaephe/web run start",
    "restartPolicyType": "ON_FAILURE",
    "healthcheckPath": "/api/health",
    "healthcheckTimeout": 100
  }
}

The issue seems to be that when Root Directory is set, everything outside it gets pruned. If that’s the case I don’t see a good way to improve the experience other than, well, not doing any pruning.

I’ll experiment with Turborepo and Railpack locally to try to handle pruning myself and see if the resulting images are leaner.


eyenalxai
PROOP

a month ago

Also I’m not sure if setting Root Directory messes up using the Pre-deploy Command from the repo root.


eyenalxai
PROOP

a month ago

Also I want to mention that what I ended up doing was much simpler than writing separate Dockerfiles for each service anyway so it’s a huge win.


Loading...