twenty/packages/twenty-docs/l/ar/developers/self-host/capabilities/troubleshooting.mdx
Charles Bochet 9d57bc39e5
Migrate from ESLint to OxLint (#18443)
## Summary

Fully replaces ESLint with OxLint across the entire monorepo:

- **Replaced all ESLint configs** (`eslint.config.mjs`) with OxLint
configs (`.oxlintrc.json`) for every package: `twenty-front`,
`twenty-server`, `twenty-emails`, `twenty-ui`, `twenty-shared`,
`twenty-sdk`, `twenty-zapier`, `twenty-docs`, `twenty-website`,
`twenty-apps/*`, `create-twenty-app`
- **Migrated custom lint rules** from ESLint plugin format to OxLint JS
plugin system (`@oxlint/plugins`), including
`styled-components-prefixed-with-styled`, `no-hardcoded-colors`,
`sort-css-properties-alphabetically`,
`graphql-resolvers-should-be-guarded`,
`rest-api-methods-should-be-guarded`, `max-consts-per-file`, and
Jotai-related rules
- **Migrated custom rule tests** from ESLint `RuleTester` + Jest to
`oxlint/plugins-dev` `RuleTester` + Vitest
- **Removed all ESLint dependencies** from `package.json` files and
regenerated lockfiles
- **Updated Nx targets** (`lint`, `lint:diff-with-main`, `fmt`) in
`nx.json` and per-project `project.json` to use `oxlint` commands with
proper `dependsOn` for plugin builds
- **Updated CI workflows** (`.github/workflows/ci-*.yaml`) — no more
ESLint executor
- **Updated IDE setup**: replaced `dbaeumer.vscode-eslint` with
`oxc.oxc-vscode` extension, configured `source.fixAll.oxc` and
format-on-save with Prettier
- **Replaced all `eslint-disable` comments** with `oxlint-disable`
equivalents across the codebase
- **Updated docs** (`twenty-docs`) to reference OxLint instead of ESLint
- **Renamed** `twenty-eslint-rules` package to `twenty-oxlint-rules`

### Temporarily disabled rules (tracked in `OXLINT_MIGRATION_TODO.md`)

| Rule | Package | Violations | Auto-fixable |
|------|---------|-----------|-------------|
| `twenty/sort-css-properties-alphabetically` | twenty-front | 578 | Yes
|
| `typescript/consistent-type-imports` | twenty-server | 3814 | Yes |
| `twenty/max-consts-per-file` | twenty-server | 94 | No |

### Dropped plugins (no OxLint equivalent)

`eslint-plugin-project-structure`, `lingui/*`, `@stylistic/*`,
`import/order`, `prefer-arrow/prefer-arrow-functions`,
`eslint-plugin-mdx`, `@next/eslint-plugin-next`,
`eslint-plugin-storybook`, `eslint-plugin-react-refresh`. Partial
coverage for `jsx-a11y` and `unused-imports`.

### Additional fixes (pre-existing issues exposed by merge)

- Fixed `EmailThreadPreview.tsx` broken import from main rename
(`useOpenEmailThreadInSidePanel`)
- Restored truthiness guard in `getActivityTargetObjectRecords.ts`
- Fixed `AgentTurnResolver` return types to match entity (virtual
`fileMediaType`/`fileUrl` are resolved via `@ResolveField()`)

## Test plan

- [x] `npx nx lint twenty-front` passes
- [x] `npx nx lint twenty-server` passes
- [x] `npx nx lint twenty-docs` passes
- [x] Custom oxlint rules validated with Vitest: `npx nx test
twenty-oxlint-rules`
- [x] `npx nx typecheck twenty-front` passes
- [x] `npx nx typecheck twenty-server` passes
- [x] CI workflows trigger correctly with `dependsOn:
["twenty-oxlint-rules:build"]`
- [x] IDE linting works with `oxc.oxc-vscode` extension
2026-03-06 01:03:50 +01:00

222 lines
12 KiB
Text
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: استكشاف الأخطاء وإصلاحها
---
## استكشاف الأخطاء وإصلاحها
إذا واجهت أي مشكلة أثناء إعداد البيئة للتطوير، أو ترقية النسخة الخاصة بك، أو استضافتها ذاتيًا، إليك بعض الحلول للمشاكل الشائعة.
### استضافة ذاتية
#### التثبيت الأولي ينتج عنه فشل المصادقة على كلمة المرور للمستخدم "بوستجريس"
🚨 **هام: هذا الحل فقط للتثبيتات الجديدة** 🚨
إذا كان لديك تطبيق Twenty موجود يحتوي على بيانات إنتاج، **لا تتبع هذه الخطوات لأنها ستحذف قاعدة البيانات الخاصة بك بشكل دائم!**
أثناء تثبيت Twenty لأول مرة، قد ترغب في تغيير كلمة المرور الافتراضية لقاعدة البيانات.
كلمة المرور التي تعيّنها أثناء التثبيت الأول يتم تخزينها بشكل دائم في حجم قاعدة البيانات. إذا حاولت لاحقًا تغيير هذه الكلمة في التكوين بدون إزالة الحجم القديم، ستحصل على أخطاء المصادقة لأن قاعدة البيانات لا تزال تستخدم كلمة المرور الأصلية.
⚠️ تحذير: اتباع الخطوات التالية سيقوم بحذف جميع بيانات قاعدة البيانات بشكل دائم! ⚠️
قم بالإجراء فقط إذا كان هذا تثبيتًا جديدًا بدون بيانات مهمة.
لتحديث `PG_DATABASE_PASSWORD` عليك القيام بما يلي:
```sh
# تحديث PG_DATABASE_PASSWORD في .env
إيقاف تشغيل docker باستخدام volumes
تشغيل docker مرة أخرى باستخدام -d
```
#### تم العثور على فواصل الخط CR [نظام Windows]
هذا بسبب حروف فواصل الخط لنظام Windows وتكوين git. حاول تشغيل:
```
git config --global core.autocrlf false
```
ثم قم بحذف المستودع واستنساخه مرة أخرى.
#### مخطط البيانات الوصفية مفقود
أثناء تثبيت Twenty، تحتاج إلى توفير قاعدة بيانات بوستجريس الخاصة بك بالمخططات والإضافات والمستخدمين الصحيحة.
إذا نجح تشغيل هذا التخصيص، يجب أن تحتوي قاعدة البيانات لديك على المخططات `default` و`metadata`.
إذا لم تكن كذلك، فتأكد من عدم وجود أكثر من مثيل بوستجريس واحد يعمل على الكمبيوتر الخاص بك.
#### لا يمكن العثور على الوحدة النمطية 'twenty-emails' أو إعلانات نوعها المقابلة.
عليك بناء حزمة `twenty-emails` قبل تشغيل تهيئة قاعدة البيانات باستخدام `npx nx run twenty-emails:build`.
#### حزمة twenty-x مفقودة
تأكد من تشغيل yarn في الدليل الجذر ثم تشغيل `npx nx server:dev twenty-server`. إذا لم يعمل ذلك، حاول بناء الحزمة المفقودة يدوياً.
#### التحقق من العمليات عند الحفظ لا يعمل
هذا يجب أن يعمل تلقائيًا مع تثبيت إضافة Oxc (`oxc.oxc-vscode`). إذا لم يعمل ذلك، حاول إضافة هذا إلى إعدادات vscode (ضمن نطاق حاوية التطوير):
```
"editor.codeActionsOnSave": {
"source.fixAll.oxc": "explicit"
}
```
#### أثناء تشغيل `npx nx start` أو `npx nx start twenty-front`، ظهرت خطأ نفاد الذاكرة
Run only the services you need, instead of `npx nx start`. على سبيل المثال، إذا كنت تعمل على الخادم، قم بتشغيل `npx nx worker twenty-server` فقط
**إذا لم يعمل ذلك:**
إذا حاولت تشغيل `npx nx run twenty-server:start` فقط على WSL وفشل مع خطأ الذاكرة أدناه:
`FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory`
الحل البديل هو تنفيذ الأمر التالي في الطرفية أو إضافته في ملف تعريف .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
**إذا لم يعمل ذلك:**
تحقق من العمليات التي تستهلك معظم ذاكرة جهازك. في Twenty، لاحظنا أن بعض إضافات VScode كانت تستهلك الكثير من الذاكرة لذا قمنا بتعطيلها مؤقتًا.
**إذا لم يعمل ذلك:**
إعادة تشغيل جهازك تساعد في تنظيف العمليات الشبحية.
#### أثناء تشغيل `npx nx start` تظهر سجلات غريبة [0] و [1]
هذا متوقع حيث أن الأمر `npx nx start` يقوم بتشغيل المزيد من الأوامر خلف الكواليس
#### لا يتم إرسال الرسائل الإلكترونية
غالبًا، يكون السبب هو أن "العامل" لا يعمل في الخلفية. حاول التشغيل
```
npx nx worker twenty-server
```
#### لا يمكن ربط حساب Microsoft 365 الخاص بي
غالبًا، يكون السبب في ذلك هو أن المسؤول الخاص بك لم يقم بتمكين رخصة Microsoft 365 لحسابك. تحقق من [https://admin.microsoft.com/](https://admin.microsoft.com/Adminportal/Home).
إذا تلقيت رمز الخطأ `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`، طالما لم تظهر أي أخطاء تكسر العمل، ينبغي أن يعمل كل شيء كما هو متوقع.
#### عند الوصول إلى صفحة تسجيل الدخول تظهر رسالة خطأ حول مستخدم غير مصرح له بمحاولة الوصول إلى مساحة العمل في السجلات
هذا متوقع لأن المستخدم غير مصرح له عندما يسجل الخروج لأن هويته لم يتم التحقق منها.
#### كيف يمكنك التأكد من عمل العامل الخاص بك؟
* اذهب إلى [webhook-test.com](https://webhook-test.com/) ونسخ **عنوان URL الخاص بك**.
<div style={{textAlign: 'center'}}>
<img src="/images/docs/developers/self-hosting/webhook-test.jpg" alt="اختبار الويب هوك" />
</div>
* افتح تطبيق Twenty الخاص بك، انتقل إلى `/settings`، وفعل التبديل المتقدم في الجزء السفلي الأيسر من الشاشة.
* إنشاء ويب هوك جديد.
* الصق **عنوان URL الفريد لخطّاف الويب الخاص بك** في الحقل **عنوان URL لنقطة النهاية** في Twenty. اضبط **عوامل التصفية** على `Companies` و`Created`.
<div style={{textAlign: 'center'}}>
<img src="/images/docs/developers/self-hosting/webhook-settings.jpg" alt="إعدادات الويب هوك" />
</div>
* انتقل إلى `/objects/companies` وأنشئ سجلاً جديدًا للشركة.
* ارجع إلى [webhook-test.com](https://webhook-test.com/) وتحقق مما إذا كانت هناك **طلب POST جديد** تم استلامه.
<div style={{textAlign: 'center'}}>
<img src="/images/docs/developers/self-hosting/webhook-test-result.jpg" alt="نتيجة اختبار الويب هوك" />
</div>
* إذا تم استلام **طلب POST**، فهذا يعني أن العامل يعمل بنجاح. وإلا، ستحتاج إلى استكشاف الأخطاء وإصلاحها لعامل التشغيل الخاص بك.
#### لا يمكن تشغيل الواجهة الأمامية وتظهر رسالة الخطأ TS5042: لا يمكن مزج خيار 'المشروع' مع ملفات المصدر في سطر الأوامר
قم بتعليق مكون التحليل في `packages/twenty-ui/vite-config.ts` كما في المثال أدناه
```
plugins: [
react({ jsxImportSource: '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';` في حاوية قاعدة البيانات للحصول على الوصول إلى لوحة الإدارة.
### 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\ndocker compose up -d
```
لاحظ أن الأمر database:reset سيقوم بمسح قاعدة البيانات الخاصة بك بالكامل وإعادة إنشائها من جديد.
#### مشاكل الاتصال خلف بروكسي عكسي
إذا كنت تستخدم Twenty خلف بروكسي عكسي وواجهت مشاكل في الاتصال:
1. **تأكد من SERVER_URL:**
تأكد من أن `SERVER_URL` في ملف `.env` يتطابق مع عنوان الوصول الخارجي الخاص بك، بما في ذلك `https` إذا كان SSL مفعلاً.
2. **التحقق من إعدادات البروكسي العكسي:**
* تأكد من أن البروكسي العكسي يقوم بتمرير الطلبات بشكل صحيح إلى خادم Twenty.
* تأكد من أن رؤوس مثل `X-Forwarded-For` و`X-Forwarded-Proto` تم ضبطها بشكل صحيح.
3. **إعادة تشغيل الخدمات:**
بعد إجراء التغييرات، أعد تشغيل كل من البروكسي العكسي وحاويات Twenty.
#### خطأ عند تحميل صورة - تم رفض الإذن
تغيير ملكية مجلد البيانات على المضيف من الجذر إلى مستخدم ومجموعة آخرين يحل هذه المشكلة.
## الحصول على المساعدة
إذا واجهت مشكلات لم يتم تغطيتها في هذا الدليل:
* تفقد السجلات:
اعرض سجلات الحاوية للرسائل الخطأ:
```bash
docker compose logs
```
* الدعم المجتمعي:
تواصل مع [مجتمع Twenty](https://github.com/twentyhq/twenty/issues) أو [قنوات الدعم](https://discord.gg/cx5n4Jzs57) للحصول على المساعدة.