Error: Cannot find module @rollup/rollup-linux-x64-gnu on Docker container #15532
Replies: 30 comments 47 replies
-
Start a new pull request in StackBlitz Codeflow. |
Beta Was this translation helpful? Give feedback.
-
If i try yarn rollup fixing but esbuild giving error :D
|
Beta Was this translation helpful? Give feedback.
-
Hi- Has anyone started working on this issue? |
Beta Was this translation helpful? Give feedback.
-
@Lymah123 You can change package manager to yarn and this line add to package.json
and for vite.config.js you can try this
Can you confirm is works or not for you? |
Beta Was this translation helpful? Give feedback.
-
Hi @BeycanDeveloper, sorry for the late response. I will check it out and let you know. |
Beta Was this translation helpful? Give feedback.
-
This is happening because you are mounting the local node_modules (containing the Windows binaries) on the container. You need to use the node_modules inside the Docker image or run For example, use a named volume and run version: '3'
services:
node:
build:
context: .
ports:
- "3035:3000"
volumes:
- ./:/usr/src/app
- node_modules:/usr/src/app/node_modules
volumes:
node_modules: |
Beta Was this translation helpful? Give feedback.
-
Add the code as below to
|
Beta Was this translation helpful? Give feedback.
-
I executed following command to install mentioned package as optional dependency for NPM and it solved the issue on my Ubuntu Linux local and Docker Image using Github Actions as well. I was facing this issue on latest Vite v5.1.3.
|
Beta Was this translation helpful? Give feedback.
-
this is weird, I don't have this issue on my another project, but
thankyou @viral-antuit |
Beta Was this translation helpful? Give feedback.
-
I had to use below code in package.json file and remove node_modules folder and run npm install. "overrides": {
"vite": {
"rollup": "npm:@rollup/wasm-node"
}
} I had to run below commands for dockerized app where docker compose run [service-name] npm i && \
docker compose down && \
rm -rf node_modules && \
docker compose up --build |
Beta Was this translation helpful? Give feedback.
-
For me I am using SvelteKit and I had to reinstall my adapter.
then
J |
Beta Was this translation helpful? Give feedback.
-
In my setup, similar issue got fixed by downgrading Vite to |
Beta Was this translation helpful? Give feedback.
-
if you are using yarn install, add |
Beta Was this translation helpful? Give feedback.
-
I ran into this problem and none of the above works for me. Is there any other way to fix this? |
Beta Was this translation helpful? Give feedback.
-
It doesn't makes any sense. The deployment was even working until last month, and now it doesn't work anymore. I had to use the rollup plugin as optional dependency. |
Beta Was this translation helpful? Give feedback.
-
I had the same error here, but with vitejs, and I fixed it adding I've deleted |
Beta Was this translation helpful? Give feedback.
-
There is two solutions for this, at least what i know
I code on windows and my app is build on two differents platforms |
Beta Was this translation helpful? Give feedback.
-
I have tried this methods:
version: '3' services: volumes: |
Beta Was this translation helpful? Give feedback.
-
for me the culprit was i didn't have
AND the ignore file is in the same directory as the |
Beta Was this translation helpful? Give feedback.
-
I have just come across this issue after upgrading to the latest version of vite as well. Adding this line seems to fix the problem inside a container and on CI
This doesnt seem like a very good solution though because I have to manually upgrade each. Why did this change happen in a minor version? Can someone explain what the change was? Just for context, I am doing an npm install inside the container. |
Beta Was this translation helpful? Give feedback.
-
Anyone has a solution for pnpm? |
Beta Was this translation helpful? Give feedback.
-
Slightly unrelated, but I'm getting this exact error when trying to deploy a freshly created Astro project to Cloudflare Pages. Build works fine locally, but fails when cloudflare tries to do it. The error log mentions this npm issue and throws the error mentioned above. Tried adding the optional dependency and the override. Neither seems to be working. |
Beta Was this translation helpful? Give feedback.
-
I am experiencing this in the Vercel deployment's Serverless functions (generated from my Astro(SSR) project) vite: ^5.3.5 |
Beta Was this translation helpful? Give feedback.
-
Deleting the lock file was the solution for me |
Beta Was this translation helpful? Give feedback.
-
I was getting other weird errors I deleted the lockfile with My final workaround was adding the optional dependency with |
Beta Was this translation helpful? Give feedback.
-
what worked for me was that in the .gitignore i had package-lock.json i only removed that and it just worked. |
Beta Was this translation helpful? Give feedback.
-
i just add this line in volumes docker-compose.yml
here is my complete file: services: backend: Issue is resolved now. |
Beta Was this translation helpful? Give feedback.
-
I had this problem using docker because the package is necessary only in Linux (I use windows but docker linux)
By mounting - /usr/app/frontend/node_modules in Docker Compose, you instructed Docker to treat node_modules as a container-specific directory, keeping it independent from your host environment. |
Beta Was this translation helpful? Give feedback.
-
My solution is not related to Docker, but this is the first result on Google for the error message so this might help others. This error occurred for me in runtime logs of Vercel for an Astro website. It was because I was using loadEnv from vite in my project files to check the value of an environment variable. I removed loadEnv from my project files except the astro config file (you need to use loadEnv here rather than import.meta.env) and it fixed the issue. No need for optional dependencies or installing the missing rollup package. I did also delete package-lock.json and the node_modules folder and run npm install but not sure I needed to in hindsight. Also make sure Vercel is not using a build cache. |
Beta Was this translation helpful? Give feedback.
-
I've had the same issue when using CircleCI. Can confirm adding the optionalDependencies as per #15532 (comment) works :) |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
I researched and tried on the sites below and on many different platforms, but I could not find a solution. I am using node:lts and also I cannot download this module in my docker container due to system incompatibility.
So I honestly don't know what to do right now.
#15120
rollup/rollup#5194
#15167
Reproduction
https://stackblitz.com/edit/vite-yxshfw?file=docker-compose.yml,package.json
Steps to reproduce
No response
System Info
Used Package Manager
npm
Logs
Validations
Beta Was this translation helpful? Give feedback.
All reactions