Workspaces issue: Error running deno run dev command while starting Oak server
Error running an Oak backend server which imports shared packages server lib I've created.
When running deno run dev in my backend app in my monorepo deno workspaces project.
I have shared a packages folder using workspaces (again workspaces being plugged as working on Syntax) But keep running into this error when trying to run my backend in the apps folder which imports the shared backend lib.
I can't seem to use my backend shared packages because of the error above. Any ideas on how to solve it?
22 Replies
cc @dsherret
what's your setup like? Are you're using
DENO_FUTURE=1
or do you have unstable-byonm
set?
if you're using DENO_FUTURE=1
, it depends on what version of deno you have installed because that's under active development, but I believe in the latest you can run deno install
to fix it. Otherwise, if you're using npm to manage your node_modules directory then you need to manually add that package as a dependency to your package.json and then install the npm dependency via npmI've sent DENO_FUTURE=1 in my zshrc
I am using Deno canary
what are you using to install your npm packages?
Where should I run deno install
in the root of the monorepo?
in every project?
basically anywhere in the project and it should install the same
*workspace
Wait 2 mins will circle back
it should work with
deno install
as long as oak is in one of your deno.json files I think, otherwise it's a bug
basically deno install
should see that jsr:@oak/oak@16.1.0
has a dependency on that npm package and it should add it to the node_modules folder
Boom issue one resolved
Thank you
I do have another question
When deploying my application using deno deploy
great! I'm not sure all this works in deno deploy at the moment. You're on the bleeding edge...
how can we deploy our monorepo apps then?
I am subbed to Deno Deploy pro plan and have about a week or two's work ready for deployment...
Deno 2.0 hasn't been released, which has the DENO_FUTURE functionality, so it hasn't been added to Deno Deploy because it's unstable
So workspaces doesn't work yet with the deno ecosystem
Are we a day away or do I rewrite the last two weeks worth of work?
I am on the fences to just switch to Golang and Deploy with Koyeb as I don't have time to wait long.
I really just need an estimate on when I can deploy this monorepo on Deno infra, if its a week or so away I can wait. If its months away I will rewrite and will have to build on something else.
i'm not sure about the state of workspaces in deploy, but definitely setting
DENO_FUTURE=1
is not supported at the momentDamnnnnnnnnn
What would you recommend I do
Migrate?
If I can't deploy....
for deno deploy, i'd recommend unsetting the experimental DENO_FUTURE=1 and see if it works then
based on that error message you posted though, it looks like workspace support hasn't landed in deploy yet. I'll check now for sure though. You can work around it by using an import map and mapping the specifiers like
"@scope/server": "../relative-path-to-package/mod.ts"
just checked in on the status of workspaces and the implementation in deploy is being worked on at the moment. I don't have an estimate for when it will be supported, but you can manually write in the resolution in the meantime in the main deno.json that gets resolved in deploy https://docs.deno.com/runtime/manual/basics/import_maps/
To re-iterate, instead of relying on the automatic workspace resolution, you can manually write it in the import map (deno.json) like this:
then once workspace support lands in Deploy you can remove that and actually switch to workspaces@dsherret mmmm I think I have that already, let me post
Yes I am already hard coding to the server package. I can't seem to run Deno Install in the actions
@dsherret
https://github.com/zemili-group/moonrepoV3/actions/runs/10636277085/job/29487717483
here's a link to the latest run, it feels like its close but the shared server package is throwing....
GitHub
chore: fixing deno install - mo fixes · zemili-group/moonrepoV3@681...
Deno monorepo on deno deploy all things zemil-group - chore: fixing deno install - mo fixes · zemili-group/moonrepoV3@681872f
Yo everything deployed
Boom, its working
@dsherret Thanks so much for the help!
sorry, I'm just away from my computer getting lunch
awesome! I'm glad that worked. Yeah then once workspace support lands in deploy you can remove all that.