温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/docs/project/building-windows
点击访问原文链接

Building Windows - Bun

Building Windows - BunSkip to main contentBun home pageSearch...⌘KInstall BunSearch...NavigationContributingBuilding WindowsRuntimePackage ManagerBundlerTest RunnerGuidesReferenceBlogFeedbackdiv:first-child]:!hidden peer-[.is-custom]:[&>div:first-child]:sm:!hidden peer-[.is-custom]:[&>div:first-child]:md:!hidden peer-[.is-custom]:[&>div:first-child]:lg:!hidden peer-[.is-custom]:[&>div:first-child]:xl:!hidden">Get StartedWelcome to BunInstallationQuickstartTypeScriptbun initbun createCore RuntimeBun RuntimeWatch ModeDebuggingREPLbunfig.tomlFile & Module SystemFile TypesModule ResolutionJSXAuto-installPluginsFile System RouterHTTP serverServerRoutingCookiesTLSError HandlingMetricsNetworkingFetchWebSocketsTCPUDPDNSData & StorageCookiesFile I/OStreamsBinary DataArchiveSQLSQLiteS3RedisConcurrencyWorkersProcess & SystemEnvironment VariablesShellSpawnInterop & ToolingNode-APIFFIC CompilerTranspilerUtilitiesSecretsConsoleYAMLMarkdownJSON5JSONLHTMLRewriterHashingGlobSemverColorUtilsStandards & CompatibilityGlobalsBun APIsWeb APIsNode.js CompatibilityContributingRoadmapBenchmarkingContributingBuilding WindowsBindgenLicenseOn this pagePrerequisitesEnable ScriptsSystem DependenciesBuildingExtra pathsTestsTroubleshooting.rc file fails to buildfailed to write output ‘bun-debug.exe’: permission deniedContributingBuilding WindowsCopy pagespan]:line-clamp-1 overflow-hidden group flex items-center py-0.5 gap-1 text-sm text-gray-950/50 dark:text-white/50 group-hover:text-gray-950/70 dark:group-hover:text-white/70 rounded-none rounded-r-xl border px-3 border-gray-200 aspect-square dark:border-white/[0.07] bg-background-light dark:bg-background-dark hover:bg-gray-600/5 dark:hover:bg-gray-200/5" aria-label="More actions" type="button" id="radix-_R_2shjinpfd9rqaabsnpfdb_" aria-haspopup="menu" aria-expanded="false" data-state="closed">*]:[overflow-wrap:anywhere]">Building Bun on Windows

Copy pagespan]:line-clamp-1 overflow-hidden group flex items-center py-0.5 gap-1 text-sm text-gray-950/50 dark:text-white/50 group-hover:text-gray-950/70 dark:group-hover:text-white/70 rounded-none rounded-r-xl border px-3 border-gray-200 aspect-square dark:border-white/[0.07] bg-background-light dark:bg-background-dark hover:bg-gray-600/5 dark:hover:bg-gray-200/5" aria-label="More actions" type="button" id="radix-_R_5hjinpfd9rqaabsnpfdb_" aria-haspopup="menu" aria-expanded="false" data-state="closed">This document describes the build process for Windows. If you run into problems, please join the #contributing channel on our Discord for help. It is strongly recommended to use PowerShell 7 (pwsh.exe) instead of the default powershell.exe. ​Prerequisites ​Enable Scripts By default, running unverified scripts are blocked. CopySet-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted ​System Dependencies Bun v1.1 or later. We use Bun to run it’s own code generators. Copyirm bun.sh/install.ps1 | iex Visual Studio with the “Desktop Development with C++” workload. While installing, make sure to install Git as well, if Git for Windows is not already installed. Visual Studio can be installed graphically using the wizard or through WinGet: Copywinget install "Visual Studio Community 2022" --override "--add Microsoft.VisualStudio.Workload.NativeDesktop Microsoft.VisualStudio.Component.Git " -s msstore After Visual Studio, you need the following: LLVM 21.1.8 Go Rust NASM Perl Ruby Node.js The Zig compiler is automatically downloaded, installed, and updated by the building process. Scoop can be used to install these remaining tools easily. Scoop (x64)Copyirm https:http://get.scoop.sh | iex scoop install nodejs-lts go rust nasm ruby perl ccache # scoop seems to be buggy if you install llvm and the rest at the same time scoop install llvm@21.1.8 For Windows ARM64, download LLVM 21.1.8 directly from GitHub releases (first version with ARM64 Windows builds): ARM64Copy# Download and install LLVM for ARM64 Invoke-WebRequest -Uri "https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.8/LLVM-21.1.8-woa64.exe" -OutFile "$env:TEMP\LLVM-21.1.8-woa64.exe" Start-Process -FilePath "$env:TEMP\LLVM-21.1.8-woa64.exe" -ArgumentList "/S" -Wait Please do not use WinGet/other package manager for these, as you will likely install Strawberry Perl instead of a more minimal installation of Perl. Strawberry Perl includes many other utilities that get installed into $Env:PATH that will conflict with MSVC and break the build. If you intend on building WebKit locally (optional, x64 only), you should install these packages: ScoopCopyscoop install make cygwin python Cygwin is not required for ARM64 builds as WebKit is provided as a pre-built binary. From here on out, it is expected you use a PowerShell Terminal with .\scripts\vs-shell.ps1 sourced. This script is available in the Bun repository and can be loaded by executing it: Copy.\scripts\vs-shell.ps1 To verify, you can check for an MSVC-only command line such as mt.exe CopyGet-Command mt It is not recommended to install ninja / cmake into your global path, because you may run into a situation where you try to build bun without .\scripts\vs-shell.ps1 sourced. ​Building Copybun run build # after the initial `bun run build` you can use the following to build ninja -Cbuild/debug If this was successful, you should have a bun-debug.exe in the build/debug folder. Copy.\build\debug\bun-debug.exe --revision You should add this to $Env:PATH. The simplest way to do so is to open the start menu, type “Path”, and then navigate the environment variables menu to add C:\.....\bun\build\debug to the user environment variable PATH. You should then restart your editor (if it does not update still, log out and log back in). ​Extra paths WebKit is extracted to build/debug/cache/webkit/ Zig is extracted to build/debug/cache/zig/bin/zig.exe ​Tests You can run the test suite either using bun test or by using the wrapper script bun node:test . The bun node:test command runs every test file in a separate instance of bun.exe, to prevent a crash in the test runner from stopping the entire suite. Copy# Setup bun i --cwd packages\bun-internal-test # Run the entire test suite with reporter # the package.json script "test" uses "build/debug/bun-debug.exe" by default bun run test # Run an individual test file: bun-debug test node\fs bun-debug test "C:\bun\test\js\bun\resolve\import-meta.test.js" ​Troubleshooting ​.rc file fails to build llvm-rc.exe is odd. don’t use it. use rc.exe, to do this make sure you are in a visual studio dev terminal, check rc /? to ensure it is Microsoft Resource Compiler ​failed to write output ‘bun-debug.exe’: permission denied you cannot overwrite bun-debug.exe if it is already open. you likely have a running instance, maybe in the vscode debugger?

Was this page helpful?

YesNoSuggest editsRaise issueContributingPreviousBindgenNext⌘IxgithubdiscordyoutubePowered by

智能索引记录