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
I tried to build and run a Vite project using @solana/web3.js@rc in Docker. I tried the docker images gcr.io/distroless/nodejs22-debian12 and node:22-slim and ran into the same error.
The error:
$ docker run -e DATABASE_URL=$DATABASE_URL -p 3000:3000 webnode:internal/modules/esm/resolve:839 throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null); ^Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'ws' imported from /app/server/node_modules/@solana/rpc-subscriptions-transport-websocket/dist/index.node.mjs at packageResolve (node:internal/modules/esm/resolve:839:9) at moduleResolve (node:internal/modules/esm/resolve:908:18) at defaultResolve (node:internal/modules/esm/resolve:1039:11) at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:554:12) at ModuleLoader.resolve (node:internal/modules/esm/loader:523:25) at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38) at ModuleJob._link (node:internal/modules/esm/module_job:126:49) { code: 'ERR_MODULE_NOT_FOUND'}Node.js v22.6.0error: script "docker:start" exited with code 1
Steps to reproduce
The Dockerfile:
# syntax = docker/dockerfile:1# Adjust BUN_VERSION as desiredARG BUN_VERSION=1.1.22
FROM oven/bun:${BUN_VERSION}-slim as base
# Install packages needed to build node modulesRUN --mount=type=cache,id=cache,target=/var/cache/apt \
--mount=type=cache,id=lib,target=/var/lib/apt \
apt-get update -qq && \
apt-get install --no-install-recommends -y unzip
LABEL fly_launch_runtime="Bun"WORKDIR /app
ENV NODE_ENV="production"# Throw-away build stage to reduce size of final imageFROM base as build
# Install node modulesCOPY --link bun.lockb package.json ./
RUN --mount=type=cache,id=bun,target=/root/.bun \
bun install --frozen-lockfile
# Copy application codeCOPY --link . .
# Build applicationRUN bun run build
# Final stage for app imageFROM gcr.io/distroless/nodejs22-debian12 AS run
LABEL fly_launch_runtime="Node.js"WORKDIR /app
ENV NODE_ENV="production"COPY --from=build /app/.output ./
# Start the server by default, this can be overwritten at runtimeEXPOSE 3000
CMD ["./server/index.mjs"]
Let me know if you need a full reproduction.
Description of bug
'ws' should be resolved inside of @solana/rpc-subscriptions-transport-websocket in a NodeJS environment.
The text was updated successfully, but these errors were encountered:
I'm wondering if this could be a bun issue wrt resolving the dependencies. I haven't used bun before and I'm not aware of anyone having used it with web3js yet.
If you could provide a complete repro that'd be really helpful, since I don't think any of us have anything similar yet.
Can you also clarify whether you've tested this with bun outside of Docker? Or are you only using bun in the Dockerfile? It'd be good to narrow this down to bun or the Docker image as a starting point.
Because there has been no activity on this issue for 7 days since it was closed, it has been automatically locked. Please open a new issue if it requires a follow up.
Overview
I tried to build and run a Vite project using @solana/web3.js@rc in Docker. I tried the docker images gcr.io/distroless/nodejs22-debian12 and node:22-slim and ran into the same error.
The error:
Steps to reproduce
The
Dockerfile
:Let me know if you need a full reproduction.
Description of bug
'ws' should be resolved inside of @solana/rpc-subscriptions-transport-websocket in a NodeJS environment.
The text was updated successfully, but these errors were encountered: