You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{serve}from'@hono/node-server'import{Hono}from'hono'constapp=newHono()app.get('/',(c)=>{returnc.text('Hello Hono!')})constport=3005console.log(`Server is running on port ${port}`)serve({fetch: app.fetch,
port
})
Creating the Dockerfile
FROM node:20-alpine AS baseFROM base AS builderRUN apk add --no-cache libc6-compatWORKDIR /appCOPY package*json tsconfig.json src ./RUN npm install -g npm@10.4.0RUN npm i && \npm run build && \npm prune --productionFROM base AS runnerWORKDIR /appRUN addgroup --system --gid 1001 nodejsRUN adduser --system --uid 1001 honoCOPY --from=builder --chown=hono:nodejs /app/node_modules /app/node_modulesCOPY --from=builder --chown=hono:nodejs /app/dist /app/distUSER honoEXPOSE 3000CMD ["node", "/app/dist/index.js"]
The following steps shall be taken in advance.
Add "outDir": ". /dist" to the compilerOptions section tsconfig.json.
Add "exclude": ["node_modules"] to tsconfig.json.
Add "build": "tsc" to script section of package.json.
Run npm install typescript --save-dev.
When you finally go to create the docker image with
docker build -t hono-docker .
You will get the error:
> [builder 4/4] RUN npm ci && npm run build && npm prune --production:
1.615
1.615 added 11 packages, and audited 12 packages in 1s
1.615
1.615 2 packages are looking for funding
1.615 run `npm fund` for details
1.615
1.615 found 0 vulnerabilities
1.616 npm notice
1.616 npm notice New minor version of npm available! 10.2.4 -> 10.4.0
1.616 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.4.0>
1.616 npm notice Run `npm install -g npm@10.4.0` to update!
1.616 npm notice
1.742
1.742 > build
1.742 > tsc
1.742
2.555 node_modules/@hono/node-server/dist/listener.d.ts(1,49): error TS2307: Cannot find module 'node:http' or its corresponding type declarations.
2.555 node_modules/@hono/node-server/dist/listener.d.ts(2,57): error TS2307: Cannot find module 'node:http2' or its corresponding type declarations.
2.555 node_modules/@hono/node-server/dist/server.d.ts(1,29): error TS2307: Cannot find module 'node:net' or its corresponding type declarations.
2.555 node_modules/@hono/node-server/dist/types.d.ts(1,105): error TS2307: Cannot find module 'node:http' or its corresponding type declarations.
2.555 node_modules/@hono/node-server/dist/types.d.ts(2,196): error TS2307: Cannot find module 'node:http2' or its corresponding type declarations.
2.555 node_modules/@hono/node-server/dist/types.d.ts(3,82): error TS2307: Cannot find module 'node:https' or its corresponding type declarations.
2.555 node_modules/hono/dist/types/context.d.ts(54,5): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
2.555 node_modules/hono/dist/types/context.d.ts(134,5): error TS2300: Duplicate identifier 'render'.
2.556 node_modules/hono/dist/types/hono-base.d.ts(58,5): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
2.556 node_modules/hono/dist/types/request.d.ts(16,5): error TS18028: Private identifiers are only available when targeting ECMAScript 2015 and higher.
------
Dockerfile:10
--------------------
9 |
10 | >>> RUN npm ci && \
11 | >>> npm run build && \
12 | >>> npm prune --production
13 |
--------------------
ERROR: failed to solve: process "/bin/sh -c npm ci && npm run build && npm prune --production" did not complete successfully: exit code: 2
View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/4azjzio33qpvfftx7cblxkp8j
What is the expected behavior?
No response
What do you see instead?
No response
Additional information
No response
The text was updated successfully, but these errors were encountered:
What version of Hono are you using?
4.0.0
What runtime/platform is your app running on?
Node.js
What steps can reproduce the bug?
Follow the documentation on this page:
https://hono.dev/getting-started/nodejs
cd my-app npm i
You will have this in your index.ts
Creating the Dockerfile
The following steps shall be taken in advance.
Add "outDir": ". /dist" to the compilerOptions section tsconfig.json.
Add "exclude": ["node_modules"] to tsconfig.json.
Add "build": "tsc" to script section of package.json.
Run npm install typescript --save-dev.
When you finally go to create the docker image with
docker build -t hono-docker .
You will get the error:
What is the expected behavior?
No response
What do you see instead?
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: