Getting a build error when building frontend

I'm getting the below error when doing npm run build on my .wasp/build/web-app/ path. failed to load config from <path>/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.
3 Replies
kapa.ai
kapa.ai22h ago
Hi @LuzzaMcGuzza. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The error you're encountering—specifically, "Cannot find module @rollup/rollup-darwin-arm64" and the note about an npm bug with optional dependencies—can often be resolved by cleaning up your project's dependencies and reinstalling them. This is a known issue with npm, especially when building Wasp projects. Based on the knowledge sources, the recommended steps are: 1. Delete node_modules and package-lock.json
Remove both the node_modules directory and the package-lock.json file from your .wasp/build/web-app directory. 2. Reinstall dependencies
Run npm install again in the .wasp/build/web-app directory. 3. Rebuild the frontend
After reinstalling, try running your build command again:
REACT_APP_API_URL=<url_to_wasp_backend> npm run build

REACT_APP_API_URL=<url_to_wasp_backend> npm run build

This approach is suggested in the Wasp documentation and community discussions for resolving npm-related build issues, especially when optional dependencies or platform-specific modules are involved. If you continue to have issues, you may also try running wasp clean in your project root and then starting the process again, as this will remove old build artifacts and dependencies, forcing a fresh setup the next time you build or start your project. This has helped other users resolve similar npm install/build errors in Wasp projects Discord support thread. If the problem persists after these steps, please provide more details or error logs for further troubleshooting. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @LuzzaMcGuzza, 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?
LuzzaMcGuzza
LuzzaMcGuzzaOP22h ago
@kapa.ai I have tried to run wasp clean and wasp build, followed by npm build with the same error appearing
kapa.ai
kapa.ai22h ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- Thank you for clarifying that you've already tried wasp clean and wasp build, followed by npm run build, but the same error persists. Based on the knowledge sources, the recommended next step is to manually delete both the node_modules directory and the package-lock.json file inside your .wasp/build/web-app directory, and then run npm install again before attempting the build. This is specifically mentioned as a solution for npm issues related to optional dependencies and platform-specific modules, which matches the error you're seeing:
Please try npm i again after removing both package-lock.json and node_modules directory.
Discord support thread So, the steps are: 1. In .wasp/build/web-app, delete node_modules and package-lock.json:
rm -rf node_modules package-lock.json

rm -rf node_modules package-lock.json

2. Reinstall dependencies:
npm install

npm install

3. Try building again:
REACT_APP_API_URL=<url_to_wasp_backend> npm run build

REACT_APP_API_URL=<url_to_wasp_backend> npm run build

If you have already done this and the error still appears, the knowledge sources do not provide further troubleshooting steps for this specific npm/rollup-darwin-arm64 issue. In that case, you may need to consult the linked npm issue or seek further help from the Wasp community, as the problem may be related to your specific environment or a deeper npm bug. Let me know if these steps help or if you encounter any new errors. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @LuzzaMcGuzza, 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?

Did you find this page helpful?