> ## Documentation Index
> Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# تشغيل n8n محليًا مع CometAPI

> استخدم هذا الدليل لتشغيل n8n محليًا مع CometAPI من خلال إعدادات النشر المحلي وبيانات الاعتماد والوصول إلى النموذج.

انشر n8n على جهازك الخاص ووَصِّله بـ CometAPI عبر عقدة المجتمع لتشغيل سير عمل AI المؤتمتة محليًا.

## المتطلبات الأساسية

* Linux ‏(Ubuntu/Debian/CentOS، إلخ) أو macOS
* ذاكرة RAM بسعة 2 GB+، ومساحة قرص فارغة 10 GB+
* وصول إلى Shell مع إمكانية الوصول إلى سجل npm العام
* Node.js 18.x أو 20.x LTS (راجع الخطوة 1)
* حساب CometAPI مع مفتاح API نشط — [احصل على مفتاحك من هنا](https://www.cometapi.com/console/token)

<Steps>
  <Step title="احصل على مفتاح API الخاص بـ CometAPI">
    سجّل الدخول إلى [لوحة تحكم CometAPI](https://www.cometapi.com/console/token). انقر على **Add API Key** وانسخ مفتاح API الخاص بـ CometAPI.

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/overview/810968_364191.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=aef81a83f29f8eb16655ed4060425f50" alt="لوحة تحكم CometAPI تعرض زر Add API Key" width="3824" height="1892" data-path="images/overview/810968_364191.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/cometapi/HhtmQffktazbxUvS/images/overview/810968_364193.png?fit=max&auto=format&n=HhtmQffktazbxUvS&q=85&s=d893f659267150d0faf45f99eb5dffc1" alt="تفاصيل مفتاح API في CometAPI مع base URL" width="2434" height="1232" data-path="images/overview/810968_364193.png" />
    </Frame>
  </Step>

  <Step title="ثبّت Node.js عبر nvm">
    يتطلب n8n 1.x استخدام Node.js 18.x أو 20.x. النهج الموصى به هو [nvm](https://github.com/nvm-sh/nvm):

    ```bash theme={null}
    # Install nvm
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

    # Reload your shell profile
    source ~/.bashrc   # or ~/.zshrc on macOS

    # Install and activate the LTS version
    nvm install --lts
    nvm use --lts

    # Verify
    node -v
    npm -v
    ```

    <Note>
      إذا ظهرت لك لاحقًا الرسالة `n8n: command not found`، فأعد تشغيل الطرفية أو تأكد من أن دليل npm global bin المُدار بواسطة nvm موجود ضمن `PATH` لديك.
    </Note>
  </Step>

  <Step title="ثبّت n8n وابدأ تشغيله">
    ```bash theme={null}
    npm install -g n8n
    n8n -v       # verify the installed version
    n8n start    # runs on http://localhost:5678/
    ```

    إذا كان المنفذ 5678 مستخدمًا بالفعل:

    ```bash theme={null}
    export N8N_PORT=5679
    n8n start
    ```

    للإبقاء على n8n قيد التشغيل بعد إغلاق الطرفية:

    ```bash theme={null}
    npm install -g pm2
    pm2 start "n8n" --name n8n
    pm2 save
    pm2 status
    ```

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_360463.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=80fe6068a8af4ec3b3503ff41d378a17" alt="الطرفية تعرض بدء تشغيل n8n بنجاح" width="715" height="451" data-path="images/integrations/810968_360463.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_360464.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=77cadfd218dbe0fef19fe701550ea363" alt="سجلات بدء تشغيل n8n في الطرفية" width="759" height="460" data-path="images/integrations/810968_360464.png" />
    </Frame>
  </Step>

  <Step title="أنشئ حساب المالك الخاص بك">
    افتح [http://localhost:5678/](http://localhost:5678/) في متصفحك. عند التشغيل لأول مرة، سيطلب منك معالج الإعداد إنشاء حساب **Owner** (بريد إلكتروني + كلمة مرور). أكمل ذلك ثم سجّل الدخول.

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_360465.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=8fdd100138f2bf01bbf834d9db1ea29e" alt="معالج الإعداد الأول في n8n يطلب تفاصيل حساب Owner" width="1249" height="970" data-path="images/integrations/810968_360465.png" />
    </Frame>
  </Step>

  <Step title="ثبّت عقدة مجتمع CometAPI">
    1. انتقل إلى **Settings** (أسفل اليسار) → **Community nodes**
    2. انقر على **Install a community node**
    3. أدخل اسم الحزمة: `@cometapi-dev/n8n-nodes-cometapi`
    4. حدّد مربع الإقرار بالمخاطر وانقر على **Install**

    بعد التثبيت، يمكنك البحث عن **CometAPI** في لوحة العقد.

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_360467.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=1c107922e16332157d278bf834b3e32a" alt="لوحة Settings في n8n تعرض قسم Community nodes" width="1265" height="975" data-path="images/integrations/810968_360467.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_360468.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=98c05d77cb6adf333052b4d5014fc506" alt="نافذة التثبيت مع إدخال اسم حزمة CometAPI" width="1261" height="965" data-path="images/integrations/810968_360468.png" />
    </Frame>

    <Note>
      إذا كان قسم Community Nodes غير موجود: تأكد من أنك سجلت الدخول باستخدام حساب **Owner**، وتحقق من **Settings → Security** للتأكد من أن تثبيت community node مُمكّن.
    </Note>
  </Step>

  <Step title="أنشئ سير عمل واضبط بيانات الاعتماد">
    1. انقر على **+ New** في الأعلى لإنشاء سير عمل.
    2. انقر على **+** في مساحة العمل وابحث عن **CometAPI** لإضافة العقدة.

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_360469.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=b47e1304ec3165720dd3ef37e1429485" alt="مساحة سير العمل في n8n مع فتح البحث عن عقدة CometAPI" width="1235" height="899" data-path="images/integrations/810968_360469.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_360472.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=b765a2d8024f4c5d36305916c440d02f" alt="تمت إضافة عقدة CometAPI إلى مساحة n8n" width="1724" height="854" data-path="images/integrations/810968_360472.png" />
    </Frame>

    3. أضف عقدة **Manual Trigger** ووصلها بعقدة CometAPI.
    4. في عقدة CometAPI، ضمن **Credential to connect with**، اختر **Create new**. الصق مفتاح API الخاص بـ CometAPI في **CometAPI Key** ثم انقر على **Save**. تكون قيمة Base URL الافتراضية هي `https://api.cometapi.com` وعادةً لا تحتاج إلى تغيير.

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_360474.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=deee1c999cbfb2c432daaa53904d6b38" alt="نافذة بيانات اعتماد CometAPI مع إدخال مفتاح API" width="1906" height="608" data-path="images/integrations/810968_360474.png" />
    </Frame>

    5. اضبط العقدة:

    * **Model**: أدخل model ID الحالي الذي تريد استخدامه
    * **Messages**: اضبط Role على `user`، وContent على Prompt الاختبار الخاص بك (مثلًا `Hello`)
    * اختياري: أضف رسالة `system`، واضبط **Max Tokens** و**Temperature** وما إلى ذلك.

    6. انقر على **Execute step** لتشغيل العقدة. تعرض لوحة **Output** استجابة JSON.

    <Frame>
      <img src="https://mintcdn.com/cometapi/SZhlxZhCnMLn__BW/images/integrations/810968_360471.png?fit=max&auto=format&n=SZhlxZhCnMLn__BW&q=85&s=6953b97533f02e4f50cb1f0490ff057d" alt="لوحة الإخراج في n8n تعرض استجابة JSON ناجحة من CometAPI" width="2092" height="1762" data-path="images/integrations/810968_360471.png" />
    </Frame>
  </Step>
</Steps>

<AccordionGroup>
  <Accordion title="استكشاف الأخطاء وإصلاحها">
    * **أخطاء `node-gyp` أو أخطاء البناء الأصلية** — ثبّت أدوات البناء: `sudo apt install build-essential python3` ‏(Debian/Ubuntu) أو Xcode Command Line Tools ‏(macOS).
    * **أخطاء أذونات npm ‏(EACCES)** — استخدم nvm لتثبيت Node.js على مستوى المستخدم؛ لا حاجة إلى `sudo`.
    * **تعارض المنفذ (`localhost:5678` غير متاح)** — اضبط `N8N_PORT=5679` (أو أي منفذ حر آخر) قبل تشغيل `n8n start`.
    * **قسم Community Nodes غير موجود** — سجّل الدخول باستخدام حساب **Owner** وتحقق من **Settings → Security**.
    * **فشل npm install على شبكات الشركات** — اضبط proxy: `npm config set proxy http://user:pass@host:port`
    * **تعيد عقدة CometAPI رمز 401/403** — تحقّق من مفتاح API الخاص بك ومن أن model متاح ضمن خطة CometAPI الخاصة بك.
    * **استجابات فارغة أو أخطاء حد token** — زِد **Max Tokens**؛ واضبط **Temperature** و**Top P** حسب الحاجة.
    * **يتوقف n8n عند إغلاق الطرفية** — استخدم pm2: `pm2 start "n8n" --name n8n && pm2 save`.
  </Accordion>
</AccordionGroup>

<script type="application/ld+json">
  {`
    {
    "@context": "https://schema.org",
    "@graph": [
      {
        "@type": "HowTo",
        "@id": "https://apidoc.cometapi.com/integrations/n8n-local-deployment#howto",
        "name": "تشغيل n8n محليًا مع CometAPI",
        "description": "استخدم هذا الدليل لتشغيل n8n محليًا مع CometAPI من خلال تهيئة إعدادات النشر المحلي وبيانات الاعتماد وإمكانية الوصول إلى model.",
        "step": [
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/n8n-local-deployment#step-1",
            "position": 1,
            "name": "احصل على مفتاح API الخاص بـ CometAPI",
            "text": "أنشئ حساب CometAPI الخاص بك أو افتحه، ثم انسخ مفتاح API نشطًا من لوحة التحكم."
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/n8n-local-deployment#step-2",
            "position": 2,
            "name": "ثبّت Node.js عبر nvm",
            "text": "أكمل خطوة تثبيت Node.js عبر nvm في دليل تشغيل n8n محليًا مع CometAPI."
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/n8n-local-deployment#step-3",
            "position": 3,
            "name": "ثبّت n8n وابدأ تشغيله",
            "text": "أكمل خطوة تثبيت n8n وبدء تشغيله في دليل تشغيل n8n محليًا مع CometAPI."
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/n8n-local-deployment#step-4",
            "position": 4,
            "name": "أنشئ حساب المالك الخاص بك",
            "text": "أكمل خطوة إنشاء حساب المالك الخاص بك في دليل تشغيل n8n محليًا مع CometAPI."
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/n8n-local-deployment#step-5",
            "position": 5,
            "name": "ثبّت عقدة مجتمع CometAPI",
            "text": "أكمل خطوة تثبيت عقدة مجتمع CometAPI في دليل تشغيل n8n محليًا مع CometAPI."
          },
          {
            "@type": "HowToStep",
            "@id": "https://apidoc.cometapi.com/integrations/n8n-local-deployment#step-6",
            "position": 6,
            "name": "أنشئ سير عمل واضبط بيانات الاعتماد",
            "text": "أكمل خطوة إنشاء سير عمل وضبط بيانات الاعتماد في دليل تشغيل n8n محليًا مع CometAPI."
          }
        ]
      },
      {
        "@type": "BreadcrumbList",
        "itemListElement": [
          {
            "@type": "ListItem",
            "position": 1,
            "name": "مستندات CometAPI",
            "item": "https://apidoc.cometapi.com/"
          },
          {
            "@type": "ListItem",
            "position": 2,
            "name": "عمليات التكامل",
            "item": "https://apidoc.cometapi.com/integrations"
          },
          {
            "@type": "ListItem",
            "position": 3,
            "name": "تشغيل n8n محليًا مع CometAPI",
            "item": "https://apidoc.cometapi.com/integrations/n8n-local-deployment"
          }
        ]
      }
    ]
    }
    `}
</script>
