nx: Command error ^[[12;1R

Current Behavior

When I run any NX command, such as nx run admin:build:production (or development) the console prints the line ^[[12;1R and doesn’t proceed.

Expected Behavior

Expect the command to execute the build process and finish.

GitHub Repo

No response

Steps to Reproduce

  1. Install NX 18.1.1 on Windows 10
  2. Create a new Angular project
  3. Try to execute any command (For serve/build or development/production)

During the project creation I got this error message

warning: in the working copy of '.editorconfig', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of '.eslintignore', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of '.eslintrc.json', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of '.gitignore', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of '.prettierignore', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of '.prettierrc', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of '.vscode/extensions.json', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'README.md', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'apps/nrwl/.eslintrc.json', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'apps/nrwl/jest.config.ts', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'apps/nrwl/project.json', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'apps/nrwl/src/app/app.component.html', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'apps/nrwl/src/app/app.component.spec.ts', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'apps/nrwl/src/app/app.component.ts', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'apps/nrwl/src/app/app.config.ts', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'apps/nrwl/src/app/app.routes.ts', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'apps/nrwl/src/app/nx-welcome.component.ts', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'apps/nrwl/src/index.html', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'apps/nrwl/src/main.ts', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'apps/nrwl/src/styles.scss', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'apps/nrwl/src/test-setup.ts', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'apps/nrwl/tsconfig.app.json', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'apps/nrwl/tsconfig.editor.json', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'apps/nrwl/tsconfig.json', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'apps/nrwl/tsconfig.spec.json', LF will be replaced by CRLF the next time Git touches itwarning: in the working copy of 'jest.config.ts', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'jest.preset.js', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'nx.json', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'package-lock.json', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'package.json', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'tsconfig.base.json', LF will be replaced by CRLF the next time Git touches it

Nx Report

Node   : 20.11.0
OS     : win32-x64
npm    : 10.2.4

nx (global)        : 18.0.1
nx                 : 18.1.1
@nx/js             : 18.1.1
@nx/jest           : 18.1.1
@nx/linter         : 18.1.1
@nx/eslint         : 18.1.1
@nx/workspace      : 18.1.1
@nx/angular        : 18.1.1
@nx/devkit         : 18.1.1
@nx/eslint-plugin  : 18.1.1
@nrwl/tao          : 18.1.1
@nx/web            : 18.1.1
@nx/webpack        : 18.1.1
typescript         : 5.3.3

Failure Logs

Executing task: npx nx run nrwl:serve --configuration=development 

> nx run nrwl:serve:development

^[[12;1R

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

This error ^[[12;1R is not always the same, but always similar, such as ^[[6;1R, ^[[4;1R or ^[[2;1R

About this issue

  • Original URL
  • State: open
  • Created 3 months ago
  • Reactions: 50
  • Comments: 34 (6 by maintainers)

Most upvoted comments

As metionate, in https://github.com/nrwl/nx/issues/21779 and https://github.com/nrwl/nx/issues/21838, add

NX_NATIVE_COMMAND_RUNNER=false

on the .env file on the root of project it mitigate the problem

We are still looking into this and actively trying to repro, but in the meantime are going to disable the native command runner on windows by default.

We are actively looking into this, but have been unable to reliably reproduce this. On my windows machine I was able to cause it to happen once, but it went away and I’ve not been able to get it to occur again.

This isn’t to say that its not reliably happening to some number of users, or that there’s not a definite cause, just that it makes it harder to nail down.

While we were troubleshooting it, @FrozenPandaz noted that an earlier PR (https://github.com/nrwl/nx/pull/21683) which was meant to fix similar issues had a minor mistake in it as we took some cargo changes for granted. A new PR (https://github.com/nrwl/nx/pull/22711 ) has been put up which will correct those inaccuracies and hopefully make this work smoother.

After that PR has been merged and released, we will have to monitor for issues as we haven’t been able to validate the fix ourselves.

NX_NATIVE_COMMAND_RUNNER=false works, but you need to write the value in lowercase. The nx code checks if !== ‘false’, so if anyone has tried to use the cross-env option and got it wrong probably it is because the value is set as FALSE

As metionate, in #21779 and #21838, add

NX_NATIVE_COMMAND_RUNNER=false

on the .env file on the root of project it mitigate the problem

This indeed solved the issue for me, at least for now I can work and compile everything locally. Waiting for a definite fix on this issue before removing .env

This is very critical issue stopping us to update our workspace. Please give a workaround or solution as its been while this exists.

Have you tried https://github.com/nrwl/nx/issues/22358#issuecomment-2018082698 ? This should not be a definite solution, but it helps to work without stopping the proccess

This is very critical issue stopping us to update our workspace. Please give a workaround or solution as its been while this exists.

@celsomtrindade I had the same issue issue like you, when execute the command nx serve fronend the command freezes and cannot be cancelled with Ctrl+C, only kill the process using Task Manager.

It is possible be an issue related with the pseudo terminals (pty) than supports Windows 10.

I detected other issues related with this, as multiple spawned conhost.exe process than using a lot of CPU.

It seems simply press ‘Enter’ after these weird characters show up will get the command going. So it’s more of annoying than a blocker for us in development. Obviously it will be a totally different story if this happens in CI. Luckily our CI is running on Linux and this issue doesn’t seem to affect it.

If it helps, the problem occurrs more often on a lower spec machine (we have a VM that gets it every time) or a machine under load

1 thing I noticed is that when I start getting the weird text, a “zombie” vscode is running in memory. Once I end that task, the weird text stopped. image

@rexkenley Those processes are conhost.exe instances for “headless” pesudoterminals, it’s the same concept as pty in UNIX platforms, allows create virtual terminals that I/O is managed by nx using Rust native command runner, but that feature seems buggy on Windows. I detected these first time when using run-many in v18.0.*, when I kill the command using Ctrl-C always leaves some zombie processes that uses a complete CPU core per instance. The noisy CPU fan let me identify that issue.

In that case, if you has NX Visual Studio Code plugin, nx server runs as VSCode child process then Task Manager shows them like that image.

1 thing I noticed is that when I start getting the weird text, a “zombie” vscode is running in memory. Once I end that task, the weird text stopped. image

@x-etienne when I tried earlier versions of nx so 18.0 I did have a .env file but after doing a upgrade to version 18.1 it seems to be removed.

and the setting to use useInferencePlugins has been moved to nx.json, I will check if creating such a file and just adding that would work.

edit: seems to work!

Same issues as already mentioned preventing to upgrade to 18.1 ( coming from 17.x )

Same issue here. Even with 18.1.2. I got it to run by using --output-style compact.

Likewise, I found a workaround for me for now.

I am having the same issue with other targets. In my case, it’s dev.

I was able to get it to work by using the shorthand instead of the full command nx dev <project-name> (not, nx run <project-name>:dev)

Same issue here. Even with 18.1.2. I got it to run by using --output-style compact.