nx icon indicating copy to clipboard operation
nx copied to clipboard

Command error ^[[12;1R

Open celsomtrindade opened this issue 11 months ago • 38 comments

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
  • [X] 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

celsomtrindade avatar Mar 17 '24 23:03 celsomtrindade

Hello, I have the same issue but using PNPM and with express and vite.

Nx Report

Node   : 20.11.1
OS     : win32-x64
pnpm   : 8.15.4

nx (global)        : 18.1.1
nx                 : 18.1.1
@nx/js             : 18.1.1
@nx/jest           : 18.1.1
@nx/eslint         : 18.1.1
@nx/workspace      : 18.1.1
@nx/cypress        : 18.1.1
@nx/eslint-plugin  : 18.1.1
@nx/nest           : 18.1.1
@nx/node           : 18.1.1
@nx/react          : 18.1.1
@nx/vite           : 18.1.1
@nx/web            : 18.1.1
@nx/webpack        : 18.1.1
typescript         : 5.3.3

When trying to serve vite project


> nx run frontend:serve

"vite" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.
Warning: command "vite serve" exited with non-zero status code
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 NX   Running target serve for project frontend failed

Failed tasks:

- frontend:serve

Hint: run the command with --verbose for more details.

When trying to serve express project

> nx run backend:serve:development

Build option outputFileName not set for backend. Using fallback value of dist\apps\backend\main.js.

> nx run backend:build

"webpack-cli" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.
Warning: command "webpack-cli build --node-env=production" exited with non-zero status code
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 NX   Ran target build for project backend (143ms)

   ×  1/1 failed
   √  0/1 succeeded [0 read from cache]

Build failed, waiting for changes to restart...

This issue is not present on nx 18.0.8.

This happens when nx is invoked from global or pnpm exec

On PNPM has a workaround: execute nx using npx than global.

joelpelaez avatar Mar 18 '24 00:03 joelpelaez

@joelpelaez I tried switching back to 18.0.8 but had the same issue. On my macbook air m1 I'm not getting this error and was able to build properly in all apps/libs, for serve/build and develop/production.

Only happening on my windows pc.

Before that I was on version 16 of NX, and that was working just fine on my windows as well.

celsomtrindade avatar Mar 18 '24 00:03 celsomtrindade

@celsomtrindade Yes, nx has a lot of issues on Windows platform, many of them related to PNPM, but its because many Node tools are for UNIX platforms.

joelpelaez avatar Mar 18 '24 00:03 joelpelaez

@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.

joelpelaez avatar Mar 18 '24 01:03 joelpelaez

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

theneongrey avatar Mar 18 '24 18:03 theneongrey

Same issue on my side using the following :

Node   : 20.10.0
OS     : win32-x64
npm    : 10.2.3

nx                 : 18.1.2
@nx/js             : 18.1.2
@nx/jest           : 18.1.2
@nx/linter         : 18.1.2
@nx/eslint         : 18.1.2
@nx/workspace      : 18.1.2
@nx/angular        : 18.1.2
@nx/cypress        : 18.1.2
@nx/devkit         : 18.1.2
@nx/eslint-plugin  : 18.1.2
@nx/nest           : 18.1.2
@nx/node           : 18.1.2
@nrwl/tao          : 18.1.2
@nx/web            : 18.1.2
@nx/webpack        : 18.1.2
typescript         : 5.3.3

Dhalias avatar Mar 19 '24 00:03 Dhalias

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)

S4GU4R0 avatar Mar 19 '24 03:03 S4GU4R0

Hi to all,

same problem here.

It's randomic, sometimes works other not.

like @celsomtrindade I receive ^[[30;1R, ^[[71;1R, and so on

Node   : 20.10.0
OS     : win32-x64
npm    : 10.2.5

nx (global)        : 18.1.2
nx                 : 18.1.2
@nx/js             : 18.1.2
@nx/jest           : 18.1.2
@nx/linter         : 18.1.2
@nx/eslint         : 18.1.2
@nx/workspace      : 18.1.2
@nx/angular        : 18.1.2
@nx/devkit         : 18.1.2
@nx/esbuild        : 18.1.2
@nx/eslint-plugin  : 18.1.2
@nx/express        : 18.1.2
@nx/node           : 18.1.2
@nrwl/tao          : 18.1.2
@nx/web            : 18.1.2
@nx/webpack        : 18.1.2
typescript         : 5.3.3
---------------------------------------

thanks

ps: @FrozenPandaz perhaps it is correlated with https://github.com/nrwl/nx/issues/22313 ?

x-etienne avatar Mar 20 '24 14:03 x-etienne

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

JelleBruisten avatar Mar 22 '24 14:03 JelleBruisten

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

x-etienne avatar Mar 25 '24 14:03 x-etienne

@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!

JelleBruisten avatar Mar 25 '24 15:03 JelleBruisten

I am not sure if this is the fix, but I deleted node_modules and package-lock.json and reran npm i. That took care of the weird text.

image

rexkenley avatar Mar 28 '24 14:03 rexkenley

Spoke too soon, some projects are still having the weird text issue. This project was generated with the @nx/react - library and @nx/storybook - configuration.

image

rexkenley avatar Mar 28 '24 15:03 rexkenley

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

ak274 avatar Apr 01 '24 14:04 ak274

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

Joredjs avatar Apr 01 '24 15:04 Joredjs

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

celsomtrindade avatar Apr 01 '24 16:04 celsomtrindade

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 avatar Apr 03 '24 15:04 rexkenley

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.

joelpelaez avatar Apr 05 '24 02:04 joelpelaez

I had a similar error with ^[[18;1 When switch beteween two projects with Angular with Applications Builder ( Based en Vite/Esbuild ) random throw error I use a VS Code Node 18.XX Angular 17

image

SkyZeroZx avatar Apr 07 '24 02:04 SkyZeroZx

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.

AgentEnder avatar Apr 08 '24 21:04 AgentEnder

Would it matter what version of window's we're using? I am currently on a window 10 machine, which I could reproduce it every time without the .env file.

JelleBruisten avatar Apr 08 '24 23:04 JelleBruisten

I can easily reproduce on my win 11 laptop, but not with angular build or serve, or crystal based jest or lint... But I run into this with commands running the firebase cli using @nx:run-commands very often if not setting NX_NATIVE_COMMAND_RUNNER=false

atsjo avatar Apr 09 '24 12:04 atsjo

Still getting this error with 18.2.4 and the updated pty version for windows

atsjo avatar Apr 09 '24 21:04 atsjo

for those using cross-env it work fine for me as well without .env:

"start":"cross-env NX_NATIVE_COMMAND_RUNNER=FALSE nx serve <app>"

ErickRodrCodes avatar Apr 10 '24 18:04 ErickRodrCodes

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

kris-vista avatar Apr 10 '24 20:04 kris-vista

So far the definitive workaround for the weird text is

1.) Delete .nx/cache 2.) Clear any "zombie" vscode sessions in memory

Things start working again I once I do these 2 things.

rexkenley avatar Apr 11 '24 15:04 rexkenley

Upgraded from 17.2.3 to 18.2.4 and got the error why running nx test for the first time. Consecutive tests ran without problem also after clearing Nx cache

Node   : 20.11.0
OS     : win32-x64
yarn   : 1.22.19

nx                 : 18.2.4
@nx/js             : 18.2.4
@nx/jest           : 18.2.4
@nx/linter         : 18.2.4
@nx/eslint         : 18.2.4
@nx/workspace      : 18.2.4
@nx/angular        : 18.2.4
@nx/cypress        : 18.2.4
@nx/devkit         : 18.2.4
@nx/eslint-plugin  : 18.2.4
@nx/node           : 18.2.4
@nx/plugin         : 18.2.4
@nx/storybook      : 18.2.4
@nrwl/tao          : 18.2.4
@nx/web            : 18.2.4
@nx/webpack        : 18.2.4
typescript         : 5.4.5

When using nx run to start Angular application

^[[6;1R
? Port 4200 is already in use.
Would you like to use a different port? Yes <-- immeditately yes
| Generating browser application bundles (phase: building)...

aikrez avatar Apr 15 '24 13:04 aikrez

We encounter the same issue at random. Some of us get stuck with ^[[8;1R and some with ^[[10;1R. We noticed it after upgrading from 15.8.5 to 18.2.3. I think it happens independently of the Editor or IDE, as we've seen it in VSCode and WebStorm.

At least for us it seems to be happening more often in either of those two cases:

  • stopping the nx serve -o command, checkout to a different branch, then run nx serve -o again
  • run nx serve -o and immediately cancel, then run it again
    • This method seems to be the most reliable for reproducing the issue

Hollow-Ego avatar Apr 19 '24 14:04 Hollow-Ego

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.

AgentEnder avatar Apr 19 '24 14:04 AgentEnder

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.

One way to reproduce is having a VHD machine with this specs (it happens most of the time):

  • Windows 10 Enterprise 22H2 Build 19045.4046
  • Experience Feature Pack: 1000.19053.1000.0
  • Processor : Intel Xeon Gold 6240 CPU @ 2.60GHz 2.59 GHz (2 processors)
  • Ram: 32 GB

Powershell Version table:

image

The configuration belongs Likely to a vmware horizon virtual machine, which is the one I'm using. Unfortunately, I'm not authorized to disclose beyond that.

ErickRodrCodes avatar Apr 19 '24 15:04 ErickRodrCodes