Deploying npm workspaces fail

Hello! I’m having a problem while deploying from a monorepo, which is using npm workspaces. Render just doesn’t see it. (for example: npm run build -w shared is ignored). Local import works good, but deployed version fails. I don’t even know what additional info is neccessary… it just doesnt work.
Structure of my project:

root 
|---- client
|---- shared
|-----server

Client (react app) is hosted in firebase through the gh actions.
Shared folder contains types and enums.
Server is on node.js.

When i’m not using commands like npm run build -w shared and using cd shared && npm i && npm run build && cd server && npm i && npm run build it gives me error:
Mar 17 05:12:31 PM server.ts(5,91): error TS2307: Cannot find module 'shared' or its corresponding type declarations..

Buuut all node_modules are in the root directory and maybe this is the problem? Because render just doesnt see workspaces

Hi,

I suspect you may need to specify your Node version to match the version you developed on. I think our default Node/Npm may be pre-workspaces.

Alan

Thank you very much, Alan. Specifying npm && node versions worked for me.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.