Client build failed. Error: Cannot find module @rollup/rollup-darwin-arm64.
wasp version 0.16.5
MacOS M3
I am trying to deploy my app via Railway. I am able to deploy server. But facing problem when building client /web-app.
I follow wasp documentation.
Documentation link: https://wasp.sh/docs/deployment/deployment-methods/paas#railway
I am STUCK at this step.
npm install && REACT_APP_API_URL=<url_to_wasp_backend> npm run build
Below is the error.
failed to load config from /Users/mylaptop/vscode/mywebapp123/app/.wasp/build/web-app/vite.config.ts
error during build:
Error: Cannot find module @rollup/rollup-darwin-arm64. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try npm i
again after removing both package-lock.json and node_modules directory.
--> I have tried doing wasp clean and start from beginning.
--> I have tried deleting package-lock.json and node_modules then run npm install again.
--> I don't have any custom vite config apart from the one from opensaas template.
I want to try with "yarn" but I'm not sure it would give the same result as "npm".3 Replies
Hi @yj69. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I'm sorry you're running into this issue! Based on the knowledge sources, this error is likely related to how npm handles optional dependencies, especially on Apple Silicon (arm64) Macs. The error message you received—"Cannot find module @rollup/rollup-darwin-arm64"—is known to be associated with npm's handling of native modules and optional dependencies, particularly with Vite and Rollup on arm64 systems.
What the documentation and community say:
- The Wasp documentation for deploying to Railway instructs you to run
The knowledge sources do not provide a definitive solution for this specific Vite/Rollup error on Apple Silicon, nor do they confirm that using yarn will resolve it. The recommended steps are to delete
npm install
and then build the client, but does not mention using yarn or pnpm as alternatives, nor does it provide a solution for this specific error [Deploying the Client on Railway].
- There is a known npm bug related to optional dependencies, as referenced in your error message. The recommended workaround is to delete both node_modules
and package-lock.json
, then run npm install
again. You mentioned you've already tried this.
- On Apple Silicon (M1, M2, M3), Wasp recommends installing Rosetta to run x86 binaries, since the Wasp binary is built for x86, not arm64. However, this is primarily for running the Wasp CLI itself, not for npm or Vite [Quick Start: Installation].
About using yarn:
The knowledge sources do not provide any information about using yarn as a replacement for npm in this context, nor do they confirm whether it would resolve the issue. Wasp currently defaults to npm for managing dependencies, and there is no official support or documentation for using yarn or pnpm instead [Why not Node 20 yet and still npm to install packages].
What else you can try:
- Double-check that you are using the Node.js version recommended by Wasp (currently Node.js 18 LTS) [Node.js version requirement].
- Ensure that Rosetta is installed if you are running any x86 binaries on your M3 Mac [Rosetta for Apple Silicon].
- If you continue to have issues, you may want to try running the build process in a clean environment (e.g., a fresh clone of your repo in a new directory).
Summary:The knowledge sources do not provide a definitive solution for this specific Vite/Rollup error on Apple Silicon, nor do they confirm that using yarn will resolve it. The recommended steps are to delete
node_modules
and package-lock.json
, then run npm install
again, and ensure you are using the correct Node.js version. If the problem persists, it may be related to the npm bug mentioned in your error message, and you may need to wait for a fix or try building in a different environment.
If you need further help, consider reaching out on the Wasp Discord or GitHub, as others may have encountered and resolved this issue recently.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @yj69, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?I fixed this issue by downgrading from Node V22 to V20.
This is resolved.
Auf, not ideal
but I'm glad you got it working!
For anyone stumbling acorss this thread. This was fixed with Wasp 0.16.7, so just pull the newest version!