Skip to main content
目前 Remix 开发服务器(remix dev)依赖于 Bun 尚未实现的 Node.js API。下面的指南使用 Bun 来初始化项目和安装依赖,但启动开发服务器时会使用 Node.js。

使用 create-remix 初始化一个 Remix 应用。
terminal
bun create remix
 remix   v1.19.3 💿 让我们构建更好的网站...

   dir   我们应当在哪里创建你的新项目?
         ./my-app

      ◼  使用基础模板 详情见 https://remix.run/docs/en/main/guides/templates#templates
      ✔  模板已复制

   git   是否初始化新的 git 仓库?


  deps   使用 bun 安装依赖?


      ✔  依赖已安装
      ✔  Git 已初始化

  done   完成!
         使用 cd ./my-app 进入项目目录
         查看 README.md 获取开发和部署说明。

要启动开发服务器,从项目根目录运行 bun run dev。这将使用 remix dev 命令启动开发服务器。请注意,运行时仍然会使用 Node.js。
terminal
cd my-app
bun run dev
$ remix dev

💿  remix dev

info  building...
info  built (263ms)
Remix App Server started at http://localhost:3000 (http://172.20.0.143:3000)

打开 http://localhost:3000 查看应用。对 app/routes/_index.tsx 的任何修改都会在浏览器中热重载。
在本地运行的 Remix 应用

要构建并启动你的应用,运行 bun run build
terminal
bun run build
$ remix build
info  building... (NODE_ENV=production)
info  built (158ms)
然后在项目根目录运行 bun run start
terminal
bun start
$ remix-serve ./build/index.js
[remix-serve] http://localhost:3000 (http://192.168.86.237:3000)

更多使用 Remix 构建应用的内容,请查阅 Remix 文档