Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nx Format The command line is too long. #15301

Closed
Zeus-The-Cat opened this issue Feb 27, 2023 · 1 comment · Fixed by #15322
Closed

Nx Format The command line is too long. #15301

Zeus-The-Cat opened this issue Feb 27, 2023 · 1 comment · Fixed by #15322
Assignees
Labels

Comments

@Zeus-The-Cat
Copy link

Current Behavior

Running Nx format using prettier.js errors with the line
"The command line is too long."

I'm assuming this is caused by the current implementation not taking into consideration the maximum command line limit of 8191 characters.

Expected Behavior

Nx format should format any project regardless of path depth.

GitHub Repo

No response

Steps to Reproduce

  1. Create a project with deeply nested folder structure
  2. Hit the command line limit of 8191 characters
  3. format your project using Nx format and prettier.js

Nx Report

Node : 16.16.0
   OS   : win32 x64
   npm  : 8.11.0

   nx : 13.8.1
   @nrwl/angular : 13.8.1
   @nrwl/cli : 13.8.1
   @nrwl/cypress : 13.8.1
   @nrwl/detox : undefined
   @nrwl/devkit : 13.8.1
   @nrwl/eslint-plugin-nx : 13.8.1
   @nrwl/express : undefined
   @nrwl/jest : 13.8.1
   @nrwl/js : undefined
   @nrwl/linter : 13.8.1
   @nrwl/nest : undefined
   @nrwl/next : undefined
   @nrwl/node : undefined
   @nrwl/nx-cloud : undefined
   @nrwl/react : undefined
   @nrwl/react-native : undefined
   @nrwl/schematics : undefined
   @nrwl/storybook : 13.8.1
   @nrwl/tao : 13.8.1
   @nrwl/web : undefined
   @nrwl/workspace : 13.8.1
   typescript : 4.5.5
   rxjs : 7.4.0
   ---------------------------------------
   Community plugins:
         @angular/animations: 13.2.2
         @angular/cdk: 13.2.2
         @angular/common: 13.2.2
         @angular/compiler: 13.2.2
         @angular/core: 13.2.2
         @angular/elements: 13.2.2
         @angular/forms: 13.2.2
         @angular/localize: 13.2.2
         @angular/material: 13.2.2
         @angular/material-moment-adapter: 13.2.2
         @angular/platform-browser: 13.2.2
         @angular/platform-browser-dynamic: 13.2.2
         @angular/router: 13.2.2
         @ng-bootstrap/ng-bootstrap: 7.0.0
         @ngrx/effects: 9.2.0
         @ngrx/entity: 9.2.0
         @ngrx/router-store: 9.2.0
         @ngrx/store: 9.2.0
         @ngrx/store-devtools: 9.2.0
         @ngx-pwa/local-storage: 13.0.2
         ngx-bootstrap: 8.0.0
         ngx-build-plus: 9.0.6
         @angular-devkit/build-angular: 13.2.3
         @angular/cli: 13.2.3
         @angular/compiler-cli: 13.2.2
         @angular/language-service: 13.2.2
         @storybook/angular: 6.4.19
         @testing-library/angular: 11.0.4

Failure Logs

No response

Additional Information

Adding a check that the path of the ~/bin-prettier.js file with --{any flags (write, check, etc.)} and the files passed does not exceed 8191 per batched format.

if windows os
  arrOfFiles = [...]
  fileListLength = arrOfFiles.reduce( ( acc, curr ) => acc+curr.length+2, 0) + arrOfFiles.length - 1
  `${path-to/bin-prettier.js} --${largest flag}`.length + fileListLength < 8191
@AgentEnder AgentEnder added the scope: core core nx functionality label Feb 28, 2023
@AgentEnder AgentEnder self-assigned this Feb 28, 2023
AgentEnder added a commit to AgentEnder/nx that referenced this issue Feb 28, 2023
Windows has a pretty short terminal length built in, and we can get
errors such as "The command line is too long."

Closes nrwl#15301
AgentEnder added a commit to AgentEnder/nx that referenced this issue Feb 28, 2023
Windows has a pretty short terminal length built in, and we can get
errors such as "The command line is too long."

Closes nrwl#15301
@github-actions
Copy link

github-actions bot commented Apr 2, 2023

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants