Files
twenty/packages/twenty-docs/l/zh/developers/self-hosting/troubleshooting.mdx
T
e02c24bd3a i18n - docs translations (#15904)
Created by Github action

---------

Co-authored-by: Abdul Rahman <ar5438376@gmail.com>
Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
Co-authored-by: github-actions <github-actions@twenty.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
2025-11-18 17:21:48 +01:00

227 lines
8.7 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: 疑難排解
image: /images/user-guide/what-is-twenty/20.png
---
<Frame>
<img src="/images/user-guide/what-is-twenty/20.png" alt="Header" />
</Frame>
## 疑難排解
如果您在設置開發環境、升級實例或自托管時遇到任何問題,這裡有一些常見問題的解決方案。
### 自行託管
#### 首次安裝結果為 `password authentication failed for user "postgres"`
🚨 **重要提示:此解決方案僅適用於新安裝** 🚨
如果您已經有一個包含生產數據的Twenty實例,**請勿**遵循這些步驟,因為它們將永久刪除您的數據庫!
在首次安裝Twenty時,您可能想要更改默認的數據庫密碼。
您在首次安裝時設置的密碼將永久存儲在數據庫卷中。 如果您後來嘗試在配置中更改此密碼而不刪除舊卷,則會遇到身份驗證錯誤,因為數據庫仍在使用原始密碼。
⚠️ 警告:以下步驟將永久刪除所有數據庫數據! ⚠️
只有在這是一個沒有重要數據的新安裝的情況下才進行。
要更新 `PG_DATABASE_PASSWORD`,您需要:
```sh
# Update the PG_DATABASE_PASSWORD in .env
docker compose down --volumes
docker compose up -d
```
#### 發現CR換行符 [Windows]
這是由於Windows的換行符和git配置導致的。 嘗試運行: 嘗試運行:
```
git config --global core.autocrlf false
```
然後刪除倉庫並再次克隆它。
#### 缺少元數據架構
在Twenty安裝期間,您需要用正確的架構、擴展和用戶來準備您的postgres數據庫。
如果您成功運行了這個配置,您應該在數據庫中擁有 `default` 和 `metadata` 架構。
如果沒有,請確保電腦上沒有運行多個postgres實例。
#### 無法找到模組 'twenty-emails' 或其相應的類型聲明。
您需要先構建 `twenty-emails` 包,然後再用 `npx nx run twenty-emails:build` 初始化數據庫。
#### 缺少 twenty-x 包
確保在根目錄運行 yarn,然後運行 `npx nx server:dev twenty-server`。 如果還是無法運行,請嘗試手動構建缺失的包。 如果還是無法運行,請嘗試手動構建缺失的包。
#### 保存時的 Lint 不工作
這應該在安裝了eslint擴展的情況下開箱即用。 這應該在安裝了eslint擴展的情況下開箱即用。 如果這不起作用,請嘗試將此添加到您的vscode設置(在開發容器範圍上):
```
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
```
#### 運行 `npx nx start` 或 `npx nx start twenty-front` 時,內存不足錯誤被拋出
在 `packages/twenty-front/.env` 中取消註釋 `VITE_DISABLE_TYPESCRIPT_CHECKER=true` 和 `VITE_DISABLE_ESLINT_CHECKER=true` 以禁用後台檢查,從而減少所需的RAM量。
**如果不工作:**
僅運行您需要的服務,而不是 `npx nx start`。 例如,如果您在服務器上工作,僅運行 `npx nx worker twenty-server` 例如,如果您在服務器上工作,僅運行 `npx nx worker twenty-server`
**如果不工作:**
如果您嘗試僅在 WSL 上運行 `npx nx run twenty-server:start`,但失敗並顯示以下內存錯誤:
`重大錯誤:在堆限制附近無效的標記緊湊分配失敗 - JavaScript 堆內存不足`
解決方法是在終端執行以下命令,或將其添加到 .bashrc 配置檔中以自動設置:
`export NODE_OPTIONS="--max-old-space-size=8192"`
\--max-old-space-size=8192 標誌為 Node.js 堆設置了一個上限8GB,使用需求隨應用程序需求而定。
參考資料:https://stackoverflow.com/questions/56982005/where-do-i-set-node-options-max-old-space-size-2048
參考資料:https://stackoverflow.com/questions/56982005/where-do-i-set-node-options-max-old-space-size-2048
**如果不工作:**
調查哪些進程佔用了您大部分的機器RAM。 在Twenty,我們注意到一些VScode擴展佔用了很多RAM,因此我們暫時禁用了它們。
**如果不工作:**
重啟您的機器有助於清理幽靈進程。
#### 運行 `npx nx start` 時日誌中存在奇怪的 [0] 和 [1]
這是預期的,因為命令 `npx nx start` 在底層運行了更多命令
#### 電子郵件未發送
大多數情況下,這是因為 `worker` 沒有在後台運行。 嘗試運行
```
npx nx worker twenty-server
```
#### 無法連接我的 Microsoft 365 帳戶
大多數情況下,這是因為您的管理員未為您的帳戶啟用 Microsoft 365 許可證。 檢查 [https://admin.microsoft.com/](https://admin.microsoft.com/Adminportal/Home)。 檢查 [https://admin.microsoft.com/](https://admin.microsoft.com/Adminportal/Home)。
如果出現錯誤碼 `AADSTS50020`,這可能意味著您正在使用個人Microsoft帳戶。 這尚不支持。 如果出現錯誤碼 `AADSTS50020`,這可能意味著您正在使用個人Microsoft帳戶。 這尚不支持。 查看更多信息 [這裡](https://learn.microsoft.com/fr-fr/troubleshoot/entra/entra-id/app-integration/error-code-aadsts50020-user-account-identity-provider-does-not-exist)
#### 運行 `yarn` 時控制台中出現警告
警告提示會告知拉取一些未在 `package.json` 中明確聲明的附加依賴項,只要沒有出現嚴重錯誤,一切應該按預期運行。
#### 當用戶訪問登錄頁面時,日誌中出現未授權用戶嘗試訪問工作區的錯誤
這是預期的,因為用戶在登出時未被授權,因為其身份未經驗證。
#### 如何檢查您的 `worker` 是否正在運行?
- 轉到 [webhook-test.com](https://webhook-test.com/) 並複製 **您的唯一Webhook URL**。
<div style={{textAlign: 'center'}}>
<img src="/images/docs/developers/self-hosting/webhook-test.jpg" alt="Webhook test" />
</div>
- Open your Twenty app, navigate to `/settings`, and enable the **Advanced** toggle at the bottom left of the screen.
- Create a new webhook.
- Paste **Your Unique Webhook URL** in the **Endpoint Url** field in Twenty. 將 **Filters** 設置為 `Companies` 和 `Created`。
<div style={{textAlign: 'center'}}>
<img src="/images/docs/developers/self-hosting/webhook-settings.jpg" alt="Webhook settings" />
</div>
- Go to `/objects/companies` and create a new company record.
- Return to [webhook-test.com](https://webhook-test.com/) and check if a new **POST request** has been received.
<div style={{textAlign: 'center'}}>
<img src="/images/docs/developers/self-hosting/webhook-test-result.jpg" alt="Webhook test result" />
</div>
- If a **POST request** is received, your worker is running successfully. 否則,您需要對您的 `worker` 進行疑難排解。
#### 前端啟動失敗,返回錯誤 TS5042:選項 'project' 不能與命令行上的源文件混合使用
註釋掉 `packages/twenty-ui/vite-config.ts` 中的檢查器插件,參考下面的示例
```
plugins: [
react({ jsxImportSource: '@emotion/react' }),
tsconfigPaths(),
svgr(),
dts(dtsConfig),
// checker(checkersConfig),
wyw({
include: [
'**/OverflowingTextWithTooltip.tsx',
'**/Chip.tsx',
'**/Tag.tsx',
'**/Avatar.tsx',
'**/AvatarChip.tsx',
],
babelOptions: {
presets: ['@babel/preset-typescript', '@babel/preset-react'],
},
}),
],
```
#### 管理面板不可訪問
在數據庫容器中運行 `UPDATE core."user" SET "canAccessFullAdminPanel" = TRUE WHERE email = 'you@yourdomain.com';` 獲取管理面板訪問權限。
### 1-click Docker compose
#### 無法登錄
如果您在設置後無法登錄:
1. 運行以下命令:
```bash
docker exec -it twenty-server-1 yarn
docker exec -it twenty-server-1 npx nx database:reset --configuration=no-seed
```
2. 重新啟動Docker容器:
```bash
docker compose down
docker compose up -d
```
請注意,database:reset 命令將完全擦除您的數據庫並從頭重建。
#### 反向代理後的連接問題
如果您在反向代理後運行Twenty並遇到連接問題:
1. **驗證 SERVER_URL**
確保 `.env` 文件中的 `SERVER_URL` 與您的外部訪問網址匹配,如果啟用了SSL,請包括 `https`。
2. **檢查反向代理設置:**
- 確認您的反向代理正確轉發了對Twenty服務器的請求。
- 確保標頭如 `X-Forwarded-For` 和 `X-Forwarded-Proto` 已正確設置。
3. **重啟服務:**
進行更改後,重新啟動反向代理和Twenty容器。
#### 上傳圖像時發生錯誤 - 權限被拒絕
將主機上數據文件夾的所有權從root切換到其他用戶和組解決了這個問題。
## 獲取幫助
如果您遇到本指南未涵蓋的問題:
- 檢查日誌:
查看容器日誌以獲取錯誤信息:
```bash
docker compose logs
```
- 社區支持:
聯繫 [Twenty社區](https://github.com/twentyhq/twenty/issues) 或 [支持渠道](https://discord.gg/cx5n4Jzs57) 獲取幫助。