nrwl / nx

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

NX "run" resulting in ERR_OUT_OF_RANGE #17528

Closed moatorres closed 1 year ago

moatorres commented 1 year ago

Current Behavior

Hello! I'm having an issue while trying to run any NX scripts/commands after running migrations. Please see the reports and logs below.

After some research I've got hints that it could be related to Node and NPM mismatches, but that's been ruled out after ensuring compatibility through nvm.

Interestingly, nx report incorrectly includes libraries as workspace plugins but existing workspace plugins are correctly listed when running nx generate from both terminal and IDE.

I'm not 100% sure that this is an issue on NX side. Already cleaned caches, did reset and reinstalled all deps (removed node_modules). Sharing here so maybe someone can shed light on the subject.

Expected Behavior

Expected to run commands such as "nx build ..." or "nx run ..." without errors.

GitHub Repo

https://github.com/moatorres/trunk

Steps to Reproduce

I'm happy to provide more info so it can be reproducible, but I'll need some help to understand what to actually add to the reproduction since it's not exactly a small project.

Nx Report

➜  trunk git:(main) ✗ yarn nx report
yarn run v1.22.19
$ /Users/moka/dev/trunk/node_modules/.bin/nx report
(node:11457) [DEP0128] DeprecationWarning: Invalid 'main' field in '/Users/moka/dev/trunk/node_modules/@nrwl/js/package.json' of 'src/index.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:11457) [DEP0128] DeprecationWarning: Invalid 'main' field in '/Users/moka/dev/trunk/node_modules/@nrwl/js/package.json' of 'src/index.js'. Please either fix that or report it to the module author

 >  NX   Report complete - copy this into the issue template

   Node   : 16.20.0
   OS     : darwin x64
   yarn   : 1.22.19
   Hasher : Native

   nx                 : 16.3.2
   @nx/js             : 16.3.2
   @nx/jest           : 16.3.2
   @nx/linter         : 16.3.2
   @nx/workspace      : 16.3.2
   @nx/cypress        : 16.3.2
   @nx/devkit         : 16.3.2
   @nx/esbuild        : 16.3.2
   @nx/eslint-plugin  : 16.3.2
   @nx/express        : 16.3.2
   @nx/nest           : 16.3.2
   @nx/next           : 16.3.2
   @nx/node           : 16.3.2
   @nx/plugin         : 16.3.2
   @nx/react          : 16.3.2
   @nx/rollup         : 16.3.2
   @nx/storybook      : 16.3.2
   @nrwl/tao          : 16.3.2
   @nx/web            : 16.3.2
   @nx/webpack        : 16.3.2
   nx-cloud           : 16.0.5
   typescript         : 5.0.4
   ---------------------------------------
   Community plugins:
   @nxtensions/astro : 3.5.0
   ---------------------------------------
   Local workspace plugins:
         @shared/ui/components/transition
         @shared/ui/components/canvas
         @shared/ui/components/badge
         @utils/encryption
         @utils/kubernetes
         @shared/design-system
         @shared/react-testing
         @utils/colors
         @utils/stylit
         @shared/react-hooks
         @shared/react-utils
         @workspace/express
         @utils/http
         @utils/node
         @shared/storybook
         @workspace/docker
         @utils/ddd
         @utils/tss
         @workspace/react
         @utils/cx

Failure Logs

>  NX   Successfully ran target serve for project backend-mock-api

 >  NX   RunStart

 >  NX   The value of "n" is out of range. It must be a non-negative number. Received '310'

RangeError [ERR_OUT_OF_RANGE]: The value of "n" is out of range. It must be a non-negative number. Received '310'
    at new NodeError (node:internal/errors:387:5)
    at WriteStream.setMaxListeners (node:events:408:11)
    at TaskOrchestrator.<anonymous> (/Users/dev/moka/trunk/node_modules/nx/src/tasks-runner/task-orchestrator.js:41:28)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/dev/moka/trunk/node_modules/tslib/tslib.js:164:62)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Operating System

Additional Information

Running files/scripts with node trunk/apps/example/src/main.tsor running distribution (node dist/etc/main.js) files do not present any errors. I'm currently unable to run any script (serve, build, test, etc) through nx (nx run project:buildor nx serve project-x). nx graph works as expected though.

FrozenPandaz commented 1 year ago

Hi, your repo isn't viewable. Could you make it public?

moatorres commented 1 year ago

Hi, your repo isn't viewable. Could you make it public?

I could, but not now. I'll try to fix it and come back as soon as I find the culprit.

moatorres commented 1 year ago

Can't repro at the moment.

Thevyn commented 1 year ago

I'm getting the same error when using nx > 16.1.4. Did you do anything to solve it? @moatorres

EDIT: Fixed, had a parallel: 6 config under nx-cloud in nx.json

moatorres commented 1 year ago

That didn't work for me, unfortunately. I have no clue why is that and the error logs are as cryptic as it gets. It all happened after executing the suggested migration that changes packages from nrlw/ to nx/. Absolute nightmare. Even VSCode's extension, by far one of the greatest features of nx, got buggy. Ended up giving up and recreating the monorepo from scratch (200+ packages). Lovely. Nx works great, but it can get in the way occasionally.

Thevyn commented 1 year ago

Yeah, I spent ages trying to figure it out also. Then I created a new nx next monorepo and started to copy over the config files one by one and accidentally found out that the culprit was that config variable.

github-actions[bot] commented 1 year ago

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.