What's wrong? How to reproduce the bug?
When using the npm create hono@latest command to create an app for deployment to Netlify, the app doesn’t build properly.
Running netlify dev results in a series of errors:
◈ Failed to run Edge Function index:
TypeError: Import 'https://registry-staging.deno.com/@hono/hono/meta.json' failed: error sending request for url (https://registry-staging.deno.com/@hono/hono/meta.json): error trying to connect: dns error: failed to lookup address information: nodename nor servname provided, or not known
at file:///Users/peter/Documents/explorations/hononetlify/netlify/edge-functions/index.ts:1:22
at async file:///Users/peter/Documents/explorations/hononetlify/.netlify/edge-functions-serve/dev.js:7:35 {
code: "ERR_MODULE_NOT_FOUND"
}
TypeError: Import 'https://registry-staging.deno.com/@hono/hono/meta.json' failed: error sending request for url (https://registry-staging.deno.com/@hono/hono/meta.json): error trying to connect: dns error: failed to lookup address information: nodename nor servname provided, or not known
at file:///Users/peter/Documents/explorations/hononetlify/netlify/edge-functions/index.ts:1:22
at async file:///Users/peter/.nvm/versions/node/v22.4.1/lib/node_modules/netlify-cli/node_modules/@netlify/edge-bundler/deno/config.ts:12:10 {
code: "ERR_MODULE_NOT_FOUND"
}
What version of Hono are you using?
4.3.11
What runtime/platform is your app running on? (with version if possible)
Netlify
Solution (what worked for me)
Use the URL method of importing packages instead of jsr.
Replace the
import { Hono } from 'jsr:@hono/hono'
import { handle } from 'jsr:@hono/hono/netlify'
with
import { Hono } from "https://deno.land/x/hono@v4.3.11/mod.ts";
import { handle } from "https://deno.land/x/hono@v4.3.11/adapter/netlify/index.ts";
Or with
import { Hono } from "https://esm.sh/jsr/@hono/hono@4";
import { handle } from "https://esm.sh/jsr/@hono/hono/netlify";
Hope this helps
What is the expected behavior?
◈ Static server listening to 3999
┌─────────────────────────────────────────────────┐
│ │
│ ◈ Server now ready on http://localhost:8888 │
│ │
└─────────────────────────────────────────────────┘
◈ Loaded edge function index
What do you see instead?
◈ Failed to run Edge Function index:
TypeError: Import 'https://registry-staging.deno.com/@hono/hono/meta.json' failed: error sending request for url (https://registry-staging.deno.com/@hono/hono/meta.json): error trying to connect: dns error: failed to lookup address information: nodename nor servname provided, or not known
at file:///Users/peter/Documents/explorations/hononetlify/netlify/edge-functions/index.ts:1:22
at async file:///Users/peter/Documents/explorations/hononetlify/.netlify/edge-functions-serve/dev.js:7:35 {
code: "ERR_MODULE_NOT_FOUND"
}
TypeError: Import 'https://registry-staging.deno.com/@hono/hono/meta.json' failed: error sending request for url (https://registry-staging.deno.com/@hono/hono/meta.json): error trying to connect: dns error: failed to lookup address information: nodename nor servname provided, or not known
at file:///Users/peter/Documents/explorations/hononetlify/netlify/edge-functions/index.ts:1:22
at async file:///Users/peter/.nvm/versions/node/v22.4.1/lib/node_modules/netlify-cli/node_modules/@netlify/edge-bundler/deno/config.ts:12:10 {
code: "ERR_MODULE_NOT_FOUND"
}
Additional information
I solved my issue by using one of the url importing methods https://deno.land/x/hono, there are others like esm https://esm.sh/jsr/@hono/hono@4, and perhaps the create command + example could show one of them.
Appreciate this is specific to deploying on Netlify, but that's what the create template using Netlify suggest user would be able to do.
What's wrong? How to reproduce the bug?
When using the
npm create hono@latestcommand to create an app for deployment to Netlify, the app doesn’t build properly.Running
netlify devresults in a series of errors:What version of Hono are you using?
4.3.11
What runtime/platform is your app running on? (with version if possible)
Netlify
Solution (what worked for me)
Use the URL method of importing packages instead of jsr.
Replace the
with
Or with
Hope this helps
What is the expected behavior?
What do you see instead?
Additional information
I solved my issue by using one of the url importing methods
https://deno.land/x/hono, there are others like esmhttps://esm.sh/jsr/@hono/hono@4, and perhaps the create command + example could show one of them.Appreciate this is specific to deploying on Netlify, but that's what the create template using Netlify suggest user would be able to do.