Convex.json external packages not installing, pnpm monorepo
So there seems to be a lack of externalPackages to support a monorepo, like ours which uses
node-linker=hoisted
in a .npmrc
The node-linker hoisted flattens and causes all modules to be installed in the root node_modules folder.
So when we define externalPackages, in our convex.json
like this:
The external packages doesn't get installed when running convex dev
Comparing to a non monorepo project, this works without problems.
A bit of a forced workaround, that solves the issue:
Manually moving a "sharp" module from the root node_modules, into the packages/backend/node_modules, will solve this issue. But seems like a bit of a forceful workaround. Even though it does work.3 Replies
Bump: would love an answer from Convex, on whether this could be fixed in the near future?
No timeline yet. There's certainly a bunch of things we could improve around monorepos. Can you configure npm to install sharp in the nested node_modules?
Thanks.
We are using PNPM as our package manager. And have tried a handfull of different ways to do exactly that, but none worked unfortunately.
Coming back to this in case anyone else stumbles over the same issue.
But a fix for us has been defining
nohoist
option in the workspaces
settings. Making sure to remove node_modules folder, clean cache and delete yarn.lock