coleam00 / bolt.new-any-llm

Prompt, run, edit, and deploy full-stack web applications using any LLM you want!
https://bolt.new
MIT License
3k stars 1.29k forks source link

Docker build error: `Cannot find module '/app/node_modules/@remix-run/dev/dist/cli.js'` when running Remix project #164

Open gerotutu opened 1 week ago

gerotutu commented 1 week ago

Describe the bug

I am building a Docker container for a Remix project and running it with docker-compose. During the startup, the application fails to find the @remix-run/dev module, specifically cli.js, and throws a MODULE_NOT_FOUND error. The build completes without issues, but the container exits with code 1 when it tries to start the Remix server.

Link to the Bolt URL that caused the error

-

Steps to reproduce

  1. Clone the project and navigate to the directory.
  2. Follow the steps in the video by Cole Medin: https://www.youtube.com/watch?v=31ivQdydmGg&ab_channel=ColeMedin
  3. Run the following commands:
    npm run dockerbuild
    docker-compose --profile development up
  4. Observe the error in the Docker container logs, which indicates that @remix-run/dev cannot be found.

Expected behavior

The container should start successfully, and the Remix server should be accessible as expected in development mode.

Screen Recording / Screenshot

No response

Platform

Additional context

C:\Users\Admin\Projects\bolt.new-any-llm>npm run dockerbuild

> dockerbuild
> docker build -t bolt-ai:development -t bolt-ai:latest --target bolt-ai-development .

[+] Building 7.2s (12/12) FINISHED                                                                                            docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                          0.0s
 => => transferring dockerfile: 1.94kB                                                                                                        0.0s
 => [internal] load metadata for docker.io/library/node:20.18.0                                                                               1.5s
 => [auth] library/node:pull token for registry-1.docker.io                                                                                   0.0s
 => [internal] load .dockerignore                                                                                                             0.0s
 => => transferring context: 427B                                                                                                             0.0s
 => [base 1/5] FROM docker.io/library/node:20.18.0@sha256:a5e0ed56f2c20b9689e0f7dd498cac7e08d2a3a283e92d9304e7b9b83e3c6ff3                    0.0s
 => => resolve docker.io/library/node:20.18.0@sha256:a5e0ed56f2c20b9689e0f7dd498cac7e08d2a3a283e92d9304e7b9b83e3c6ff3                         0.0s
 => [internal] load build context                                                                                                             4.1s
 => => transferring context: 9.92kB                                                                                                           3.5s
 => CACHED [base 2/5] WORKDIR /app                                                                                                            0.0s
 => CACHED [base 3/5] COPY package.json pnpm-lock.yaml ./                                                                                     0.0s
 => CACHED [base 4/5] RUN corepack enable pnpm && pnpm install                                                                                0.0s
 => [base 5/5] COPY . .                                                                                                                       0.2s
 => [bolt-ai-development 1/1] RUN mkdir -p ${WORKDIR}/run                                                                                     0.3s
 => exporting to image                                                                                                                        0.6s
 => => exporting layers                                                                                                                       0.3s
 => => exporting manifest sha256:2b5579db3bb3e90aa8d7398bd9c64ba8d0a1621eeda382337caecbe011fef8df                                             0.0s
 => => exporting config sha256:0e96f674ef7e2ff11da4ee3976af75b429abf9ab9b36a5f42c10d9ce9f996003                                               0.0s
 => => exporting attestation manifest sha256:a5a4a2fda303ccdac93c4389964e3c3e530e625485b525766ce4ac25a2da1832                                 0.1s
 => => exporting manifest list sha256:e77a5bc2f99eaf75353be2583af0cbaa8d66234187a32c8be8398957d0fa30c2                                        0.0s
 => => naming to docker.io/library/bolt-ai:development                                                                                        0.0s
 => => unpacking to docker.io/library/bolt-ai:development                                                                                     0.1s
 => => naming to docker.io/library/bolt-ai:latest                                                                                             0.0s
 => => unpacking to docker.io/library/bolt-ai:latest                                                                                          0.0s

 11 warnings found (use docker --debug to expand):
 - SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "OPENAI_API_KEY") (line 51)

What's next:
    View a summary of image vulnerabilities and recommendations → docker scout quickview

C:\Users\Admin\Projects\bolt.new-any-llm>docker-compose --profile development up
[+] Running 1/1
 ✔ Container boltnew-any-llm-bolt-ai-dev-1  Recreated                                                                                         4.7s
Attaching to bolt-ai-dev-1
bolt-ai-dev-1  |
bolt-ai-dev-1  | > bolt@ dev /app
bolt-ai-dev-1  | > remix vite:dev "--host" "0.0.0.0"
bolt-ai-dev-1  |
bolt-ai-dev-1  | node:internal/modules/cjs/loader:1228
bolt-ai-dev-1  |   throw err;
bolt-ai-dev-1  |   ^
bolt-ai-dev-1  |
bolt-ai-dev-1  | Error: Cannot find module '/app/node_modules/@remix-run/dev/dist/cli.js'
bolt-ai-dev-1  |     at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
bolt-ai-dev-1  |     at Module._load (node:internal/modules/cjs/loader:1051:27)
bolt-ai-dev-1  |     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
bolt-ai-dev-1  |     at node:internal/main/run_main_module:28:49 {
bolt-ai-dev-1  |   code: 'MODULE_NOT_FOUND',
bolt-ai-dev-1  |   requireStack: []
bolt-ai-dev-1  | }
bolt-ai-dev-1  |
bolt-ai-dev-1  | Node.js v20.18.0
bolt-ai-dev-1  |  ELIFECYCLE  Command failed with exit code 1.
bolt-ai-dev-1 exited with code 1

Would appreciate any guidance on resolving this issue!

witzulu commented 11 hours ago

The guide does not say you need it but you can try : npx create-remix@latest if you need to install remix. after installing it will take you into remix environment just press ctrl+c to exit back to console and try npm run dockerbuild again. Pretty sure this is not your issue as it should auto pull it but worth a try i think