-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows Support #43
Comments
JavaScriptCore does run on Windows, but it’s less well supported than Unix The main issue honestly is how bun does I/O. A lot of bun's code makes assumptions that I/O is fast and that reading/writing a file won’t block for long. This is true on Unix, but on Windows, antivirus and locking behavior is different. This means even if bun did compile successfully on Windows, it probably would freeze a lot. This is already kind of a problem in WSL when you access windows files over the network mounted fs. I’m not sure how to fix this yet, but honestly I haven’t put a lot of thought into it |
I tried spinning up a Bun Development Container on a Windows 10 with WSL 2 and did not come across any issues. Of course, I just tried the quick-start code snippet only. Still, no hiccups when setting up and getting started so I am happy for now! |
In response to the windows filesystem and bun locking thing, I think at least a half decent workaround would be to use non-blocking fs (once it is implemented) |
For Windows I/O, it may be possible to leverage the MFT for some operations, namely file enumeration. It is significantly faster than the default provided APIs. Downsides are that administrator privileges are required to read the MFT, and it's only for the NTFS filesystem. So it has some fairly big disadvantages, but I felt it was worth mentioning. Otherwise, depending on the amount of files, it might be necessary to open file handles on initialisation and keep them open for files that will be used a lot to avoid third-party AVs from constantly rescanning when the handle is opened/closed. Possibly out of scope, but it is possible to get all registered security products for a Windows install in user space, it could be used for a warning message to the user that performance may be impacted if third-party AVs are detected. |
Is there any way I can contribute to help speed up windows support? |
WSL2 is not a "a Linux emulator inside Windows" but a compatibility layer using a highly optimized subset of Hyper-V that enables running ELF64 Linux binaries natively on Windows. It has magnitudes less overhead compared to emulation or other virtualization technologies such as VirtualBox or VMWare. Sure, there is an overhead of using WSL but most of it is in higher memory usage and not so much in CPU or I/O. Phoronix test suite using WSL on Windows 10 shows you get around 87% overall performance (with WSL2) compared to bare metal and that should have improved with Windows 11. Not saying we don't need native Windows support without WSL in Bun, but for development WSL2 should be just fine. As long as you don't plan on running Bun in production on a Windows Machine ;) |
For me the main concern with WSL as a substitute for native Windows support isn't performance. It is that WSL adds a layer of complexity to getting any editor tooling working with Bun. Yes, there are ways for editors running natively on Windows to communicate with and run binaries in a WSL environment, but the last time I tried (about a year ago with Crystal), those solutions were quite fiddly and unreliable compared to programming languages with native Windows support. |
I can share a bit of different use case: I need the capability to manage npm packages and bundle code not for tooling, but on the user end of a Tauri app (similar to Electron, web apps on desktop). The end user's device could be Windows/Mac/Linux. Right now I use a combination of This is just to say there are (admittedly, weird) use cases where "WSL" vs. "native" makes a difference, regardless of the technical distinction. So I appreciate this kind of Windows support is being worked on! I also find the proposed timeframe reasonable. If you need to get it done faster, I assume you can help out, it's open source afterall. ;) |
Hi folks, just want to give assurance that we know the lack of Windows support is painful. Our goal is to have an official build for Windows before the 1.0 release of Bun, though we want to get it done much earlier than that. We are already starting to experiment with JavaScriptCore on Windows, which is the first big step. |
Detecting AVs are a great way to set off the AVs alarm |
So to add my 2 cents. Glad that it's on the roadmap & planned although I maybe don't have the same emphasis on performance. While I agree that a performant windows version of bun is extremely valuable and should probably be included before 1.0, I don't care if it's slower as long as it works. I feel like a use case that is being ignored here is simply the fact that a lot of development happens on windows even if that code runs on linux servers. So for me, it's worth having it running on windows no matter how slow because when it runs on the server in production it will be fast & efficient. Other than that just +1 for adding windows support |
Hi. I understand that this is under work, but is there any work item tracking all the pieces that need to come together for this? That way it will be easier for people to contribute. Also, is there a dev branch to keep track of for this? I myself don't need networking right now, but the ffi and typescript engine only. |
This comment was marked as spam.
This comment was marked as spam.
Is this feature perhaps removed from the priority list? 🤔 |
We expect to have a bun install-only version for Windows initially, and then a more complete version following that. |
It seems the windows release is delayed again, maybe the next release will arrive. https://bun.sh/blog/bun-v1.0.27#bundows-is-soon
And I also tried the latest canary build, |
I tried the latest canary build again. It first crashed the first time, then it seems ok later. bun 1.0.32 windows error info
bun 1.0.31 windows error info
|
And it seems the format string is not supported now. Edit: I changed |
latest canary win11: without node.exe binary in path:
with node.exe binary in path:
bunfig load not working? also seems that bunfig.toml is not loaded/respected from bunfig.toml in the cwd or alongside bun.exe, even if explicitly set with: for example with the following conf the global cache is still used:
|
oh this is interesting, with the
bug i will fix soon:tm:
im not sure ... |
win11 using latest canary from 5 hours ago:
the native binding for better-sqlite3 dll its present at C:\Users\xxxuser\AppData\Local\Temp\bunx-3147616870-@ulixee\cloud@latest\node_modules\better-sqlite3\build\Release\better_sqlite3.node and is linked against node.exe, probably the one that segfaults while loading: i'm missing something or should be possible to use prebuilt native bindings for node in bun? seems totally unclear if native node-gyp prebuilt node bindings can be shared across multiple js runtimes bun deno electron etc... seems no one can make it work without the library itself being designed without node-gyp and using runtime lazyload of node-apis as proposed here neon-bindings/neon#584 also the following folder is missing in cache: files in this folder are downloaded by a postinstallscript, so seems a symptom of not running postinstall scripts...should not bunx imply installing packages with pm trust --all? at least with bunx we are running code from the internet explicity anyway... i don't see a cli option to enable trust for bun x subcommand |
I think, we can finally close this @paperdave |
Released finally |
We sure this isn't an april's fool? 🤣 |
I'm also waiting confirmation... |
Well it exists XD, but
|
I too am having an error with bun install. But I would like to caution anyone against adding any more comments to this thread. As of @paperdave's last comment this thread should be considered completed and any errors should be raised in their own Issues to be addressed independent of this thread. @metaspartan see #9808 If people keep posting bug reports here it might be better to just lock this thread. |
I tried to install via Liu.D.H ~ 13ms 21:35 > npm install -g bun
added 3 packages in 35s
npm notice
npm notice New minor version of npm available! 10.2.4 -> 10.5.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.5.0
npm notice Run npm install -g [email protected] to update!
npm notice
Liu.D.H ~ 8.035s 21:36 > bun
C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\bun\bin\bun:1
MZx
SyntaxError: Invalid or unexpected token
at internalCompileFunction (node:internal/vm:77:18)
at wrapSafe (node:internal/modules/cjs/loader:1288:20)
at Module._compile (node:internal/modules/cjs/loader:1340:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49
Node.js v20.11.0
Liu.D.H ~ 1.191s 21:36 >
Liu.D.H ~ 19ms 21:36 > where bun
C:\Users\Liu.D.H\AppData\Roaming\npm\bun
C:\Users\Liu.D.H\AppData\Roaming\npm\bun.cmd
Liu.D.H ~ 179ms 21:36 > cat C:\Users\Liu.D.H\AppData\Roaming\npm\bun.cmd
@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\node_modules\bun\bin\bun" %*
Liu.D.H ~ 36ms 21:36 > dir C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\bun\bin
Volume in drive C is System
Volume Serial Number is 5664-FB65
Directory of C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\bun\bin
2024/04/02 21:36 <DIR> .
2024/04/02 21:36 <DIR> ..
2024/04/02 21:36 97,571,328 bun.exe
1 File(s) 97,571,328 bytes
2 Dir(s) 34,412,261,376 bytes free
Liu.D.H ~ 114ms 21:36 > mv C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\bun\bin\bun C:\Users\Liu.D.H\AppData\
Roaming\npm\node_modules\bun\bin\bun.exe
Liu.D.H ~ 107ms 21:36 > bun --version
node:internal/modules/cjs/loader:1147
throw err;
^
Error: Cannot find module 'C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\bun\bin\bun'
at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
at Module._load (node:internal/modules/cjs/loader:985:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v20.11.0
Liu.D.H ~ 90ms 21:36 >
Liu.D.H ~ 0ms 21:36 > C:\Users\Liu.D.H\AppData\Roaming\npm\node_modules\bun\bin\bun.exe --version
1.1.0
Liu.D.H ~ 36ms 21:36 > I have to rename the binary append
|
Congratulations on the Windows release. 🍾 Please make Bun available on Chocolatey (it's a package manager like Homebrew). It's essential to make it easy to instruct people how to install prerequisites for a project. I understand that you have just one PowerShell command on Windows, but if you need to install many things, this becomes complex. You want to be able to have simple instructions like:
This is equivalent to:
|
C:\Users\18333\Downloads>powershell -c "irm bun.sh/install.ps1 | iex" 1 |
My computer is PROCESS SOR ARCHITECTURE=AMD64 |
Windows support shipped in Bun v1.1. If you run into bugs or have feature requests please search for existing issues or file a new issue |
The README and releases tab implies that Windows is not supported for this project.
Is this due to WebKit (JavaScriptCore) being exclusive to *nix platforms (Linux, macOS)?
Are there any plans to support Windows?
The project works great on linux btw 😀🚀
The text was updated successfully, but these errors were encountered: