newbie help on deploying first project to deno
I asked on deno github and was told to ask on discord: https://github.com/denoland/deno/discussions/16039
I wonder if someone could help me on this, im trying to deploy a mongodb nodejs project
GitHub
Deploy question regarding using npm specifiers · Discussion #16039 ...
I'm trying to learn how to upload my MongoDB project to Deno, under deployment I selected: index.js: "use strict" const Koa = require("koa") const Bodypa...
7 Replies
I’ve read over the GitHub thread and you’re basically trying to run deno as if it were node. First of all, require is not available (as you found out). To import packages form npm you have to use the special
npm:<package>
uri syntax (that is if you don’t use import maps, but under the hood you’re doing the same):
As seen in the docs, this is an unstable feature and requires the —unstable
flag when running. Deno deploy doesn’t offer unstable APIs. Therefore, the code snippet you sent won’t be able to run on deno deploy until the npm specifier becomes stable. To run your code on deno deploy i advice you to either find native packages, try to write them yourself or wait. <:cookie_deno:1002977285734932480>addin the flag —unstable it could work?
In your local build it will work. Nonetheless you cannot set that option on deno deploy, so that’s not a viable option
try to write them yourself or waitwait what?
Take for example the mongodb package. Imagine you wanted to use it but you couldn’t on deno deploy. You could either write a driver yourself (requires skill and time) or wait for the npm thingy to be stable
I see, thank you, do you have any idea when it could be stable?
For the moment there’s no ETA, but due to the fact that it’s a highly requested, yet controversial, feature, it shouldn’t be a lot