NextJs Docker SWC issue
Unanswered
Giant panda posted this in #help-forum
Giant pandaOP
Hello having a big issue on a project containerized :
FROM node:20-alpine
WORKDIR /app
RUN apk add --no-cache python3 make g++
COPY package*.json ./
RUN npm install
COPY . .
ENV NEXT_TELEMETRY_DISABLED 1
ENV NEXT_SKIP_NATIVE_POSTINSTALL 1
EXPOSE 3000
CMD ["npm", "run", "dev"]
dashboard:
build:
context: ./dashboard
dockerfile: Dockerfile.dev
restart: unless-stopped
depends_on:
- surrealdb
ports:
- "7780:3000"
volumes:
- ./dashboard:/app
environment:
- NEXT_PUBLIC_API_URL=http://backend:3000
networks:
- specialized__under-tree-network
{
"name": "dashboard",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@hookform/resolvers": "^3.9.1",
"@next/swc-wasm-nodejs": "^15.0.3",
"@radix-ui/react-avatar": "^1.1.1",
"@radix-ui/react-checkbox": "^1.1.2",
"@radix-ui/react-context-menu": "^2.2.2",
"@radix-ui/react-dialog": "^1.1.2",
"@radix-ui/react-dropdown-menu": "^2.1.2",
"@radix-ui/react-icons": "^1.3.2",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-navigation-menu": "^1.2.1",
"@radix-ui/react-select": "^2.1.2",
"@radix-ui/react-separator": "^1.1.0",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-tabs": "^1.1.1",
"@radix-ui/react-tooltip": "^1.1.4",
"@tanstack/react-table": "^8.20.5",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "1.0.0",
"lucide-react": "^0.462.0",
"next": "^15.0.3",
"next-themes": "^0.4.3",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-hook-form": "^7.53.2",
"recharts": "^2.13.3",
"tailwind-merge": "^2.5.5",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.23.8"
},
"devDependencies": {
"typescript": "^5",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"eslint": "^8",
"eslint-config-next": "15.0.3"
}
}
6 Replies
Giant pandaOP
Errors :
2024-12-05 18:05:06 > dashboard@0.1.0 dev
2024-12-05 18:05:06 > next dev
2024-12-05 18:05:06
2024-12-05 18:05:06 ⚠ Attempted to load /app/node_modules/next/next-swc-fallback/@next/swc-linux-arm64-gnu/next-swc.linux-arm64-gnu.node, but it was not installed
2024-12-05 18:05:06 ⚠ Attempted to load /app/node_modules/next/next-swc-fallback/@next/swc-linux-arm64-musl/next-swc.linux-arm64-musl.node, but it was not installed
2024-12-05 18:05:06 ⚠ Attempted to load @next/swc-linux-arm64-gnu, but it was not installed
2024-12-05 18:05:06 ⚠ Attempted to load @next/swc-linux-arm64-musl, but it was not installed
2024-12-05 18:05:06 ⚠ Attempted to load @next/swc-wasm-nodejs, but it was not installed
2024-12-05 18:05:06 ⚠ Attempted to load @next/swc-wasm-web, but it was not installed
2024-12-05 18:05:06 ⨯ Failed to load SWC binary for linux/arm64, see more info here: https://nextjs.org/docs/messages/failed-loading-swc
Brown bear
Why are you skipping the native postinstall?
@Brown bear Why are you skipping the native postinstall?
Giant pandaOP
It was working for an other project
Brown bear
Remove it; you need the SWC binary to use SWC for built 🙂
Giant pandaOP
FROM node:20-alpine
WORKDIR /app
RUN apk add --no-cache python3 make g++
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["npm", "run", "dev"]
@Brown bear Remove it; you need the SWC binary to use SWC for built 🙂
Giant pandaOP
After removing :
2024-12-06 11:14:34 > dashboard@0.1.0 dev
2024-12-06 11:14:34 > next dev
2024-12-06 11:14:34
2024-12-06 11:14:35 ⚠ Attempted to load /app/node_modules/next/next-swc-fallback/@next/swc-linux-arm64-gnu/next-swc.linux-arm64-gnu.node, but it was not installed
2024-12-06 11:14:35 ⚠ Attempted to load /app/node_modules/next/next-swc-fallback/@next/swc-linux-arm64-musl/next-swc.linux-arm64-musl.node, but it was not installed
2024-12-06 11:14:35 ⚠ Attempted to load @next/swc-linux-arm64-gnu, but it was not installed
2024-12-06 11:14:35 ⚠ Attempted to load @next/swc-linux-arm64-musl, but it was not installed
2024-12-06 11:14:35 ⚠ Attempted to load @next/swc-wasm-nodejs, but it was not installed
2024-12-06 11:14:35 ⚠ Attempted to load @next/swc-wasm-web, but it was not installed
2024-12-06 11:14:35 ⨯ Failed to load SWC binary for linux/arm64, see more info here: https://nextjs.org/docs/messages/failed-loading-swc