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 verified that the issue exists in Next.js canary release
Provide environment information
Docker:
Docker version 20.10.14, build a224086
Next: "12.1.5"
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
Docker
Describe the Bug
Cannot run Next.js in Docker or in any Cloud Native style using containers.
Expected Behavior
I expect dependencies to be explicit and next.js to build in Docker
To Reproduce
Steps to Reproduce
Generate a new Next.js project using Next.js
npx create-next-app@latest
Create a Dockerfile
FROM node:14-buster-slim
WORKDIR /app
COPY package*.json ./
RUN yarn add -D @swc/cli @swc/core
RUN yarn install
COPY . .
CMD yarn run dev
Run this container locally in Docker:
$ docker-compose up -d
....
next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Loaded env from /app/.env
info - Attempted to load @next/swc-linux-x64-gnu, but it was not installed
info - Attempted to load @next/swc-linux-x64-gnux32, but it was not installed
info - Attempted to load @next/swc-linux-x64-musl, but it was not installed
error - Failed to load SWC binary for linux/x64, see more info here: https://nextjs.org/docs/messages/failed-loading-swc
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The text was updated successfully, but these errors were encountered:
@timjanssen95 is correct, that's the recommended way to deploy to Docker now.
In some cases your package manager (e.g. npm) might have generated a lockfile that only includes optionalDependencies specific to the platform it was generated on, preventing the optionalDependency needed for your Docker image environment from being installed.
With the latest canary, we will now try to patch the lockfile if that's the case: #36527
But the best solution is to make sure that the lockfile generated is in accordance with the build environment, or upgrade your package manager (eg.: npm i -g npm@latest)
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Verify canary release
Provide environment information
Docker:
Docker version 20.10.14, build a224086
Next: "12.1.5"
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
Docker
Describe the Bug
Cannot run Next.js in Docker or in any Cloud Native style using containers.
Expected Behavior
I expect dependencies to be explicit and next.js to build in Docker
To Reproduce
Steps to Reproduce
Generate a new Next.js project using Next.js
Create a Dockerfile
Run this container locally in Docker:
The text was updated successfully, but these errors were encountered: