Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Using concurrently for cross-platform development in n8n

Описание и применение

Статья рассматривает использование пакета concurrently в кодовой базе n8n. Он решает проблемы с отслеживанием вывода и кроссплатформенной совместимостью при запуске нескольких команд одновременно, обеспечивая четкое форматирование вывода и корректную обработку ошибок.

Задача

Running multiple commands concurrently using shell operators like '&' is difficult to track due to mixed output and fails on Windows. Additionally, if one process fails, others continue running unnoticed.

Результат

The n8n codebase uses concurrently to run TypeScript watching and Node.js processes simultaneously. This setup provides clear, prefixed output, ensures cross-platform compatibility, and handles process failures gracefully by killing dependent processes.

Рабочий процесс

  • Install the concurrently package via npm.
  • Update package.json scripts to use concurrently instead of shell operators.
  • Configure prefixes using the -n flag (e.g., -n "TypeScript,Node").
  • Configure colors using the -c flag (e.g., -c "yellow.bold,cyan.bold").
  • Add the -k flag to kill other processes if one dies.
  • List the commands to run concurrently (e.g., pnpm run watch and nodemon).

Доказательства

concurrently -k -n "TypeScript,Node" -c "yellow.bold,cyan.bold" "pnpm run watch" "nodemon --delay 1"

Источник

I faced this issue in a project, on windows machine, where the dev script had & and as a result, it failed to run.

Источник

  • Дата записи: 2026-09-05T13:44:33.630Z