跳转到主要内容
Header

先決條件

  • Linux and MacOS
  • Windows (WSL)
在您可以安裝和使用 Twenty 之前,請確保您的電腦上安裝了以下內容:
npm won’t work, you should use yarn instead. Yarn 現已隨 Node.js 發佈,因此您不需要單獨安裝它。 如果尚未啟用 Yarn,請運行 corepack enable

步驟 1:Git 克隆

在您的終端中運行以下命令。

步驟 2:定位到根目錄

cd twenty
應在接下來的步驟中,從項目根目錄運行所有命令。

步驟 3:設置 PostgreSQL 數據庫

  • Linux
  • Mac OS
  • Windows (WSL)
Option 1 (preferred): To provision your database locally: Use the following link to install Postgresql on your Linux machine: Postgresql Installation
  psql postgres -c "CREATE DATABASE \"default\";" -c "CREATE DATABASE test;"
Note: You might need to add sudo -u postgres to the command before psql to avoid permission errors.
**Option 2:** If you have docker installed:
```bash
  make postgres-on-docker
```
您現在可以以用戶 postgres 和密碼 postgres 訪問 localhost:5432 上的數據庫。

步驟 4:設置 Redis 數據庫(緩存)

Twenty 需要一個 redis 緩存來提供最佳性能
  • Linux
  • Mac OS
  • Windows (WSL)
Option 1: To provision your Redis locally: Use the following link to install Redis on your Linux machine: Redis Installation
**Option 2:** If you have docker installed:
```bash
  make redis-on-docker
```
如果您需要客戶端 GUI,我們推薦 redis insight(提供免費版本)

步驟 5:設定環境變數

使用環境變數或 .env 文件配置您的項目。 查看更多信息 這裡 複製 /front/server 中的 .env.example 文件:
cp ./packages/twenty-front/.env.example ./packages/twenty-front/.env
cp ./packages/twenty-server/.env.example ./packages/twenty-server/.env

步驟 6:安裝依賴項

要構建 Twenty 服務器並向您的數據庫種植一些數據,請運行以下命令:
yarn
Note that npm or pnpm won’t work

步驟 7:運行項目

  • Linux
  • Mac OS
  • Windows (WSL)
根據您的 Linux 發行版,Redis 服務器可能會自動啟動。 如果沒有,請檢查您的發行版的 Redis 安裝指南
用以下命令設置您的資料庫:
npx nx database:reset twenty-server
啟動服務器、工作程序和前端服務:
npx nx start twenty-server
npx nx worker twenty-server
npx nx start twenty-front
或者,您可以一次啟動所有服務:
npx nx start

步驟 8:使用 Twenty

前端 Twenty 的前端將在 http://localhost:3001 運行。 您可以使用默認的演示帳戶登錄:tim@apple.dev(密碼:tim@apple.dev 後端

疑難排解

如果您遇到任何問題,請查看疑難排解找出解決方案。