nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.27k stars 2.32k forks source link

Output gets crazy and truncate line break after re-build #22999

Open dunice opened 4 months ago

dunice commented 4 months ago

Description

After changing a file and saving it more than one time before the re-build gets completed, the output is getting crazy and truncating the line breaks (or tab format) in terminal (Oh-My-Zsh).

Also, the NX daemon simply stuck so I can't stop the execution. To do that, I have to close the window, find the PID and kill the process.

Current Behavior

[Nest] 94381  - 04/25/2024, 6:27:13 AM    WARN [ServerKafka] WARN [undefined] KafkaJS v2.0.0 switched default partitioner. To retain the same partitioning behavior as in previous versions, create the producer with the option "createPartitioner: Partitioners.LegacyPartitioner". See the migration guide at https://kafka.js.org/docs/migration-guide-v2.0.0#producer-new-default-partitioner for details. Silence this warning by setting the environment variable "KAFKAJS_NO_PARTITIONER_WARNING=1" {"timestamp":"2024-04-25T09:27:13.146Z","logger":"kafkajs"}
                                            [Nest] 94381  - 04/25/2024, 6:27:13 AM     LOG [NestApplication] Nest application successfully started +4ms
                                                                                                                                                       [Nest] 94381  - 04/25/2024, 6:27:13 AM     LOG Application listening on port 3000
                                                   [Nest] 94381  - 04/25/2024, 6:27:13 AM     LOG [ServerKafka] INFO [Consumer] Starting {"timestamp":"2024-04-25T09:27:13.160Z","logger":"kafkajs","groupId":"core-api-kafka-group-id-server"}
                                                          [Nest] 94381  - 04/25/2024, 6:27:43 AM     LOG [ServerKafka] INFO [ConsumerGroup] Consumer has joined the group {"timestamp":"2024-04-25T09:27:43.178Z","logger":"kafkajs","groupId":"core-api-kafka-group-id-server","memberId":"consumer-02863d34-77c4-49ae-9a6d-26568edcacdf-server-fa73585e-6123-4882-9ef4-940bfc569bb5","leaderId":"consumer-02863d34-77c4-49ae-9a6d-26568edcacdf-server-fa73585e-6123-4882-9ef4-940bfc569bb5","isLeader":true,"memberAssignment":{"notification":[0,1,2,3,4,5,6,7,8,9]},"groupProtocol":"RoundRobinAssigner","duration":30017}
                                                               [Nest] 94381  - 04/25/2024, 6:27:43 AM     LOG [NestMicroservice] Nest microservice successfully started +1ms

image

Expected Behavior

[Nest] 94144  - 04/25/2024, 6:26:18 AM     LOG [StripeModule] Registering Stripe webhook handlers from StripeSubscriptionWebhookService
[Nest] 94144  - 04/25/2024, 6:26:18 AM    WARN [ServerKafka] WARN [undefined] KafkaJS v2.0.0 switched default partitioner. To retain the same partitioning behavior as in previous versions, create the producer with the option "createPartitioner: Partitioners.LegacyPartitioner". See the migration guide at https://kafka.js.org/docs/migration-guide-v2.0.0#producer-new-default-partitioner for details. Silence this warning by setting the environment variable "KAFKAJS_NO_PARTITIONER_WARNING=1" {"timestamp":"2024-04-25T09:26:18.837Z","logger":"kafkajs"}
[Nest] 94144  - 04/25/2024, 6:26:18 AM     LOG [NestApplication] Nest application successfully started +4ms
[Nest] 94144  - 04/25/2024, 6:26:18 AM     LOG Application listening on port 3000
[Nest] 94144  - 04/25/2024, 6:26:18 AM     LOG [ServerKafka] INFO [Consumer] Starting {"timestamp":"2024-04-25T09:26:18.854Z","logger":"kafkajs","groupId":"core-api-kafka-group-id-server"}

image

GitHub Repo

No response

Steps to Reproduce

  1. After changing a file, save it more than one time before the re-build gets completed;

Nx Report

>  NX   Report complete - copy this into the issue template

   Node   : 20.11.1
   OS     : darwin-x64
   yarn   : 1.22.22

   nx (global)        : 18.0.6
   nx                 : 18.0.3
   @nx/js             : 18.0.3
   @nx/jest           : 18.0.3
   @nrwl/jest         : 18.3.3
   @nx/linter         : 18.0.3
   @nx/eslint         : 18.0.3
   @nx/workspace      : 18.0.3
   @nx/devkit         : 18.0.3
   @nx/eslint-plugin  : 18.0.3
   @nx/nest           : 18.0.3
   @nx/node           : 18.0.3
   @nrwl/tao          : 18.0.3
   @nx/web            : 18.0.3
   @nx/webpack        : 18.0.3
   typescript         : 5.3.3
   ---------------------------------------
   Community plugins:
   @nx-tools/nx-prisma : 5.3.0
   ---------------------------------------
   The following packages should match the installed version of nx
     - @nrwl/jest@18.3.3

   To fix this, run `nx migrate nx@18.3.3`

Failure Logs

No response

Package Manager Version

No response

Operating System

Additional Information

// project.json

{
  "name": "core-api",
  "$schema": "../../node_modules/nx/schemas/project-schema.json",
  "sourceRoot": "apps/core-api/src",
  "projectType": "application",
  "targets": {
    "serve": {
      "executor": "@nx/js:node",
      "defaultConfiguration": "development",
      "options": {
        "buildTarget": "core-api:build"
      },
      "configurations": {
        "development": {
          "buildTarget": "core-api:build:development"
        },
        "production": {
          "buildTarget": "core-api:build:production"
        }
      }
    }
  },
  "tags": []
}
// webpack.config.js

const { NxWebpackPlugin } = require('@nx/webpack');
const { join } = require('path');

module.exports = {
  output: {
    path: join(__dirname, '../../dist/apps/core-api'),
  },
  plugins: [
    new NxWebpackPlugin({
      target: 'node',
      compiler: 'tsc',
      main: './src/main.ts',
      tsConfig: './tsconfig.app.json',
      assets: ['./src/assets'],
      optimization: false,
      outputHashing: 'none',
    }),
  ],
};
mlyskawinski commented 2 months ago

This issue appears to occur when the watch process attempts to restart the build while it's already building from previous change.

chuckurbis commented 2 months ago

I have this same problem. Is there a way to to prevent watch from doing that? Perhaps to have it kill the initial build?

weilinzung commented 2 months ago

We have the same issue with the Express app that is generated from the NX node application, in nx18 happened less but nx19 happens almost every file saving.

We can't do Ctrl + C to kill the serving too and use ZSH_THEME robbyrussell.

    "@nx/devkit": "19.4.2",
    "@nx/esbuild": "19.4.2",
    "@nx/eslint": "19.4.2",
    "@nx/eslint-plugin": "19.4.2",
    "@nx/jest": "19.4.2",
    "@nx/js": "19.4.2",
    "@nx/node": "19.4.2",
    "@nx/plugin": "19.4.2",
    "@nx/webpack": "19.4.2",
    "@nx/workspace": "19.4.2",
rosslavery commented 2 months ago

Also affecting us -- I thought it was just my machine, but comforting (😅) to see others have it too

ZSH, NX19, but was also happening on NX 18 as well.

sick-sw commented 1 month ago

Same issue here

ChrisSargent commented 4 days ago

we have a similar issue, totally unrelated to builds or rebuilds for us though.