Unable to use npm packages in deno deploy

1.1k views Asked by At

From Deno 1.28, deno natively supports npm packages. But when I try to deploy it in deno-deploy. It is downloading the dependency but fails with Module not found

I am trying to deploy an express application in deno deploy.

import express from "npm:[email protected]";

const app = express();

app.get("/", (_req: any, res: any) => {
  res.send("Hello World!");
});

app.listen(80, () => {
  console.log("Server is listening on port 80");
});

But when I try to deploy it. I am getting the following error,

Cloning repository (100%)
Downloaded file:///src/server/index.ts
Downloaded npm:[email protected]
Error The deployment failed: Module not found "npm:[email protected]".

I can see the deployment step that express is downloaded. Can you someone please help me out on this ?

1

There are 1 answers

0
Jovany On

This blog tell us "npm specifiers aren't currently supported in Deploy, but will be soon.": https://deno.com/blog/npm-and-deno-anywhere