安装

Bun — A fast all-in-one JavaScript runtime

》〉curl -fsSL https://bun.sh/install | bash
######################## 100.0%
bun was installed successfully to ~/.bun/bin/bun 

Manually add the directory to ~/.zshrc (or similar):
  export BUN_INSTALL="$HOME/.bun" 
  export PATH="$BUN_INSTALL/bin:$PATH" 

To get started, run: 

  bun --help 

安装提示信息。

提示,手动配置环境信息 — 

Manually add the directory to ~/.zshrc (or similar)

VIM 配置环境

vim  ~/.zshrc

将环境信息

  export BUN_INSTALL="$HOME/.bun" 
  export PATH="$BUN_INSTALL/bin:$PATH" 

insert  .zshrc 文件最后面。

配置之后,直接运行

》〉 bun --help
zsh: command not found: bun

因为未加载环境。需要 — 

source  ~/.zshrc           // 加载环境文件

再运行 

》〉 bun --help
Bun is a fast JavaScript runtime, package manager, bundler, and test runner. (1.2.19+aad3abead)

Usage: bun <command> [...flags] [...args]

Commands:
  run       ./my-script.ts       Execute a file with Bun
            lint                 Run a package.json script
  test                           Run unit tests with Bun
  x         prettier             Execute a package binary (CLI), installing if needed (bunx)
  repl                           Start a REPL session with Bun
  exec                           Run a shell script directly with Bun

  install                        Install dependencies for a package.json (bun i)
  add       @evan/duckdb         Add a dependency to package.json (bun a)
  remove    @parcel/core         Remove a dependency from package.json (bun rm)
  update    @zarfjs/zarf         Update outdated dependencies
  audit                          Check installed packages for vulnerabilities
  outdated                       Display latest versions of outdated dependencies
  link      [<package>]          Register or link a local npm package
  unlink                         Unregister a local npm package
  publish                        Publish a package to the npm registry
  patch <pkg>                    Prepare a package for patching
  pm <subcommand>                Additional package management utilities
  info      zod                  Display package metadata from the registry


————


(more flags in bun install --help, bun test --help, and bun build --help)

Learn more about Bun:            https://bun.com/docs
Join our Discord community:      https://bun.com/discord

Logo

Agent 垂直技术社区,欢迎活跃、内容共建。

更多推荐