How to build your vite project on freeBSD
FreeBSD is a open source operating system that powers modern servers. I use a free hosting service provided by serv00 to host my personal projects, They also support git repositories and SSH access. The server where I host my projects runs on FreeBSD. I carry out most of development work on debian where I never encountered a problem while building the project. Recently I was trying to build my vite project on the server when I encountered a problem that looked something like this –
Error: Your current platform "freebsd" and architecture "x64" combination is not yet supported by the native Rollup build. Please use the WASM build "@rollup/wasm-node" instead.
A quick google search returned links to github issues and some posts made by people who encountered the same problem. It was suggested by some github users to add overrides
to my package.json
file.
I added the following lines to my package.json
file –
"overrides": {
"vite": {
"rollup": "npm:@rollup/wasm-node"
}
}
Then removed my package-lock.json
file as suggested by some github user before running npm i @rollup/wasm-node --save dev
to install the suggested package.
I tried building the project again and it was successful this time. You really need to remove the package-lock.json
file first to make it work.
Initially I also tried replacing the contents of node_modules/rollup
directory with the contents of node_modules/@rollup/wasm-node
and was able to build the project. It works But it’s not really a recommended way of doing things.
Please leave a comment if you have encountered similar issues while builiding a vite project.
Thanks for this post, it actually helped me