nx: NX Daemon server erroring out after moving to 13.7.1

I upgraded our workspace to latest NX version (13.7.1). However, I am getting following error with NX Daemon server

> NX Nx Daemon was not able to compute the project graph.

Here is the detailed log:

Messages from the log:
[NX Daemon Server] - 2022-01-31T22:54:54.560Z - Time taken for 'incremental hashing' 0.008351ms
[NX Daemon Server] - 2022-01-31T22:54:54.560Z - Error detected when recomputing project file map: ENOENT: no such file or directory, open '/Users/utsav.kapoor/thoughtspot/node_modules/@nrwl/workspace/presets/npm.json'
[NX Daemon Server] - 2022-01-31T22:54:57.389Z - [WATCHER]: 1 file(s) created or restored, 0 file(s) modified, 1 file(s) deleted
[NX Daemon Server] - 2022-01-31T22:54:57.709Z - Time taken for 'hash changed files from watcher' 118.756722ms
[NX Daemon Server] - 2022-01-31T22:54:57.709Z - Time taken for 'incremental hashing' 0.048084ms
[NX Daemon Server] - 2022-01-31T22:54:57.710Z - Error detected when recomputing project file map: ENOENT: no such file or directory, open '/Users/utsav.kapoor/thoughtspot/node_modules/@nrwl/workspace/presets/npm.json'
[NX Daemon Server] - 2022-01-31T22:55:01.667Z - Time taken for 'init hashing' 3956.459025ms
[NX Daemon Server] - 2022-01-31T22:55:03.502Z - Time taken for 'init hashing' 5791.451747ms
[NX Daemon Server] - 2022-01-31T23:06:33.319Z - [WATCHER]: js/ts-packages/create-ts-app/bin/create-ts-app was modified
[NX Daemon Server] - 2022-01-31T23:06:33.554Z - Time taken for 'hash changed files from watcher' 130.294604ms
[NX Daemon Server] - 2022-01-31T23:06:33.554Z - Time taken for 'incremental hashing' 0.117201ms
[NX Daemon Server] - 2022-01-31T23:06:33.619Z - [REQUEST]: Updated file-hasher based on watched changes, recomputing project graph...
[NX Daemon Server] - 2022-01-31T23:06:34.204Z - Time taken for 'read cache' 150.347964ms
[NX Daemon Server] - 2022-01-31T23:06:34.496Z - Time taken for 'build project graph' 165.5334ms
[NX Daemon Server] - 2022-01-31T23:06:34.516Z - Time taken for 'write cache' 19.723137ms
[NX Daemon Server] - 2022-01-31T23:06:34.516Z - Time taken for 'total execution time for createProjectGraph()' 494.093343ms
[NX Daemon Server] - 2022-01-31T23:06:34.595Z - Time taken for 'serialize graph' 79.272129ms
[NX Daemon Server] - 2022-01-31T23:07:45.573Z - [WATCHER]: Unsubscribed from changes within: /Users/utsav.kapoor/thoughtspot
[NX Daemon Server] - 2022-01-31T23:07:45.573Z - Server stopped because: "Lock file changed"```

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 21
  • Comments: 109 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Ok, I found some docs on the Daemon: https://nx.dev/guides/nx-daemon

The workaround:

export NX_DAEMON=false; or in nx.json in tasksRunnerOptions.options you can disable the daemon: "useDaemonProcess": false.

Happy to help debugging this and enable the daemon anytime to tests fixes!

I was able to fix this with npm i -g nx

This happens to me after updating nx but only on ubuntu linux (my macos setup is fine). Disabling the nx daemon “fixes” the issue but this should definitely be fixed

I was able to fix this with npm i -g nx

This did not fix it for me

Hi,

I was also facing the “NX Bad file descriptor” issue with latest nx “15.8.7” (I have upgraded to see if issue was fixed with no luck).

tl;dr:

  1. make sure every file on your monorepo it’s owned (and readable) by your user.
  2. make sure .[git|nx]ignore syntax is ok.

I was doing ok using the useDaemonProcess: false setting on nx.json. But "NX Bad file descriptor, would keep showing up eventually 😑

I have researched into nx code, coming to the conclusion that the error “Bad file descriptor” error comes from @parcel/watcher package.

This package watches for FS changes, except for .gitignore / .nxignore exceptions.

This issue on @parcel/watcher has put me on the track…

I have checked and some of the files on my docker/volumes folder belongs to other users.

My .gitignore file looked like this

docker/volumes/**

Changing it to this:

docker/volumes/*

just made the “Bad file descriptor” disappear 🥳🥳🥳.

Hope it helps someone since at least to me, it is a very frustrating error.

nothing? even with the latest version it keep stopping

Exactly the same issue since I clean my node_modules, fresh yarn install and now impossible to start nx command.

nx report

 >  NX   Report complete - copy this into the issue template

   Node : 16.14.0
   OS   : linux x64
   yarn : 1.22.17
   
   nx : 13.8.5
   @nrwl/angular : undefined
   @nrwl/cli : 13.8.5
   @nrwl/cypress : 13.8.5
   @nrwl/detox : undefined
   @nrwl/devkit : 13.8.5
   @nrwl/eslint-plugin-nx : 13.8.5
   @nrwl/express : undefined
   @nrwl/jest : 13.8.5
   @nrwl/js : 13.8.5
   @nrwl/linter : 13.8.5
   @nrwl/nest : 13.8.5
   @nrwl/next : undefined
   @nrwl/node : 13.8.5
   @nrwl/nx-cloud : 13.1.6
   @nrwl/react : 13.8.5
   @nrwl/react-native : undefined
   @nrwl/schematics : undefined
   @nrwl/storybook : 13.8.5
   @nrwl/tao : 13.8.5
   @nrwl/web : 13.8.5
   @nrwl/workspace : 13.8.5
   typescript : 4.5.5
   rxjs : 7.5.2
   ---------------------------------------
   Community plugins:
         @nx-plus/docusaurus: 12.2.0

 nx run api:serve
/home/.../node_modules/@nrwl/workspace/src/core/project-graph/daemon/client/client.js:62
        return new Error([
               ^

Error: Could not deserialize project graph.
Message: Unexpected end of JSON input


Received:



Messages from the log:
[NX Daemon Server] - 2022-03-09T22:24:09.656Z - Started listening on: /home/.../node_modules/.cache/nx/d/d.sock
[NX Daemon Server] - 2022-03-09T22:24:09.667Z - [REQUEST]: Client Request for Project Graph Received
[NX Daemon Server] - 2022-03-09T22:24:09.670Z - [REQUEST]: Updated file-hasher based on watched changes, recomputing project graph...
[NX Daemon Server] - 2022-03-09T22:24:09.719Z - Time taken for 'hash changed files from watcher' 0.052958999993279576ms

 >  NX   Bad file descriptor




More information: /home/.../node_modules/.cache/nx/d/daemon.log
    at daemonProcessException (/home/.../node_modules/@nrwl/workspace/src/core/project-graph/daemon/client/client.js:62:16)
    at Socket.<anonymous> (/home/.../node_modules/@nrwl/workspace/src/core/project-graph/daemon/client/client.js:183:32)
    at Socket.emit (node:events:532:35)
    at endReadableNT (node:internal/streams/readable:1346:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

EDIT: Found a way to make it work again:

# Reset cache
nx reset
# restart daemon
nx daemon
# if not working, try to execute your command without daemon
 export NX_DAEMON=false; nx serve api

But if I close my terminal (or in another terminal tabs) I have same issues: NX Bad file descriptor

The JSON seems not be complete:

Received:
35c0df712eeb1","deps":["backend-database","shared-domain"]},{"file":"apps/api/e2e/src/workspaces/workspace.e2e-spec.ts","hash":"e1a4b3815e7b38875e74be763dc3d9b68ddb2091","deps":["npm:supertest","npm:@nestjs/common","backend-database"]},{"file":"apps/api/e2e/src/workspaces/workspace.fixtures.ts","has

Up

For me it is a permission issue on Ubuntu. I had a standard node on which running nx commands with sudo worked fine but without i had this daemon issue. Now i’m trying to use a local install with nvm and thus i can’t sudo anymore and the only way is to deactivate daemon with NX_DAEMON=false

The solution is quite simple and it is related to CI.

If you are building stuff in your pipeline and export NX_DAEMON=false; or in nx.json in tasksRunnerOptions.options you can disable the daemon: "useDaemonProcess": false. does not work, the solution is using CI option.

you can use cross-env and use as follows:

"build" : "cross-env CI=true NX_DAEMON=false nx build"

That gave me a clean build without running the nx daemon at all.

works on nx 14 and nx 15.3:

image

People accept every “solution” that is removing the error messages… but maybe this Deamon thing has any reason to be implemented? maybe its not smart to just disable it? i still hope that someone from NX team care about this ticket any day.

Up

We have the same issue but only in the docker compilation:

 >  NX   Report complete - copy this into the issue template

   Node : 16.14.0
   OS   : darwin x64
   yarn : 1.22.17
   
   nx : 13.9.0
   @nrwl/angular : 13.9.0
   @nrwl/cypress : 13.9.0
   @nrwl/detox : undefined
   @nrwl/devkit : 13.9.0
   @nrwl/eslint-plugin-nx : undefined
   @nrwl/express : undefined
   @nrwl/jest : 13.9.0
   @nrwl/js : undefined
   @nrwl/linter : 13.9.0
   @nrwl/nest : undefined
   @nrwl/next : undefined
   @nrwl/node : undefined
   @nrwl/nx-cloud : undefined
   @nrwl/nx-plugin : undefined
   @nrwl/react : undefined
   @nrwl/react-native : undefined
   @nrwl/schematics : undefined
   @nrwl/storybook : 13.9.0
   @nrwl/web : undefined
   @nrwl/workspace : 13.9.0
   typescript : 4.5.5
   rxjs : 7.5.4
   ---------------------------------------
   Community plugins:
         @ngrx/component: 13.0.2
         @ngrx/component-store: 13.0.2
         @ngrx/effects: 13.0.2
         @ngrx/entity: 13.0.2
         @ngrx/router-store: 13.0.2
         @ngrx/store: 13.0.2
         @nguniversal/common: 13.0.2
         @nguniversal/express-engine: 13.0.2
         @compodoc/compodoc: 1.1.18
         @ngrx/schematics: 13.0.2
         @ngrx/store-devtools: 13.0.2
         @nguniversal/builders: 13.0.2

No errors inside daemon-error.log

Failed to start the Nx Daemon process.
Messages from the log:



More information: /tmp/node_modules/.cache/nx/d/daemon.log

No errors inside daemon.log

For me, after updating to 13.8.5 and re-install globally (npm i -g nx@13.8.5) I no longer have the error

Similar issue (I think).

$ nx serve

 >  NX   Nx Daemon was not able to compute the project graph.

   Log file with the error: /home/.../node_modules/.cache/nx/d/daemon-error.log
   Please file an issue at https://github.com/nrwl/nx
   Nx Daemon is going to be disabled until you run "nx reset".

Logs:

Could not deserialize project graph.
Message: Unexpected end of JSON input


Received:



Messages from the log:
[NX Daemon Server] - 2022-02-01T16:22:56.449Z - Started listening on: /home/.../node_modules/.cache/nx/d/d.sock
[NX Daemon Server] - 2022-02-01T16:22:56.460Z - [REQUEST]: Client Request for Project Graph Received
[NX Daemon Server] - 2022-02-01T16:22:56.463Z - [REQUEST]: Updated file-hasher based on watched changes, recomputing project graph...
[NX Daemon Server] - 2022-02-01T16:22:56.491Z - Time taken for 'hash changed files from watcher' 0.06311798095703125ms

 >  NX   Bad file descriptor




More information: /home/.../node_modules/.cache/nx/d/daemon.log

More logs:

[NX Daemon Server] - 2022-02-01T16:22:56.449Z - Started listening on: /home/.../node_modules/.cache/nx/d/d.sock
[NX Daemon Server] - 2022-02-01T16:22:56.460Z - [REQUEST]: Client Request for Project Graph Received
[NX Daemon Server] - 2022-02-01T16:22:56.463Z - [REQUEST]: Updated file-hasher based on watched changes, recomputing project graph...
[NX Daemon Server] - 2022-02-01T16:22:56.491Z - Time taken for 'hash changed files from watcher' 0.06311798095703125ms

 >  NX   Bad file descriptor


Nx report:

$ nx report

 >  NX   Report complete - copy this into the issue template

   Node : 17.0.1
   OS   : linux x64
   npm  : 8.1.0
   
   nx : 13.7.1
   @nrwl/angular : undefined
   @nrwl/cli : 13.7.1
   @nrwl/cypress : 13.7.1
   @nrwl/detox : undefined
   @nrwl/devkit : 13.7.1
   @nrwl/eslint-plugin-nx : 13.7.1
   @nrwl/express : undefined
   @nrwl/jest : 13.7.1
   @nrwl/js : 13.7.1
   @nrwl/linter : 13.7.1
   @nrwl/nest : 13.7.1
   @nrwl/next : undefined
   @nrwl/node : 13.7.1
   @nrwl/nx-cloud : undefined
   @nrwl/react : undefined
   @nrwl/react-native : undefined
   @nrwl/schematics : undefined
   @nrwl/storybook : undefined
   @nrwl/tao : 13.7.1
   @nrwl/web : 13.7.1
   @nrwl/workspace : 13.7.1
   typescript : 4.5.5
   rxjs : 7.5.2
   ---------------------------------------
   Community plugins:

Done in 0.52s.

I created the issue here: https://github.com/nrwl/nx/issues/19823

If you have any more information above the above issue, please add it there. If anyone has OTHER issues regarding the daemon, please report a new issue.

Thanks everyone, we’ll get this resolved soon!

Maybe this will be addressed with #16915?

Up

Still broken on linux after upgrading to Nx 15.0.13

[NX Daemon Server] - 2022-11-10T16:08:10.576Z - Started listening on: /tmp/e62b8473402edb5c619f/d.sock
[NX Daemon Server] - 2022-11-10T16:08:10.587Z - Established a connection. Number of open connections: 1
[NX Daemon Server] - 2022-11-10T16:08:10.588Z - Established a connection. Number of open connections: 2
[NX Daemon Server] - 2022-11-10T16:08:10.592Z - [REQUEST]: Client Request for Project Graph Received
[NX Daemon Server] - 2022-11-10T16:08:10.678Z - [REQUEST]: Updated file-hasher based on watched changes, recomputing project graph...
[NX Daemon Server] - 2022-11-10T16:08:11.583Z - Time taken for 'hash changed files from watcher' 0.08095300197601318ms
[NX Daemon Server] - 2022-11-10T16:08:11.584Z - Closed a connection. Number of open connections: 1
[NX Daemon Server] - 2022-11-10T16:08:11.588Z - [WATCHER]: Unexpected workspace watcher error Bad file descriptor
[Error: Bad file descriptor]
[NX Daemon Server] - 2022-11-10T16:08:12.755Z - [REQUEST]: Responding to the client. project-graph
[NX Daemon Server] - 2022-11-10T16:08:12.759Z - Time taken for 'total for creating and serializing project graph' 2162.4327889978886ms
[NX Daemon Server] - 2022-11-10T16:08:12.767Z - Done responding to the client project-graph
[NX Daemon Server] - 2022-11-10T16:08:14.667Z - [REQUEST]: Responding to the client with an error. File watcher error in the workspace '/home/xxx/Dev/xxx/xxx'. Bad file descriptor
[Error: Bad file descriptor]
[NX Daemon Server] - 2022-11-10T16:08:14.667Z - Done responding to the client null
[NX Daemon Server] - 2022-11-10T16:10:01.078Z - Started listening on: /tmp/e62b8473402edb5c619f/d.sock
[NX Daemon Server] - 2022-11-10T16:10:01.088Z - Established a connection. Number of open connections: 1
[NX Daemon Server] - 2022-11-10T16:10:01.089Z - Established a connection. Number of open connections: 2
[NX Daemon Server] - 2022-11-10T16:10:01.093Z - [REQUEST]: Client Request for Project Graph Received
[NX Daemon Server] - 2022-11-10T16:10:01.177Z - [REQUEST]: Updated file-hasher based on watched changes, recomputing project graph...
[NX Daemon Server] - 2022-11-10T16:10:01.466Z - [REQUEST]: Responding to the client. project-graph
[NX Daemon Server] - 2022-11-10T16:10:01.469Z - Time taken for 'total for creating and serializing project graph' 372.09401999786496ms
[NX Daemon Server] - 2022-11-10T16:10:01.469Z - Closed a connection. Number of open connections: 1
[NX Daemon Server] - 2022-11-10T16:10:01.473Z - [WATCHER]: Unexpected workspace watcher error Bad file descriptor
[Error: Bad file descriptor]
[NX Daemon Server] - 2022-11-10T16:10:01.479Z - Done responding to the client project-graph
[NX Daemon Server] - 2022-11-10T16:10:03.268Z - [REQUEST]: Responding to the client with an error. File watcher error in the workspace '/home/xxx/Dev/xxx/xxx'. Bad file descriptor
[Error: Bad file descriptor]
[NX Daemon Server] - 2022-11-10T16:10:03.268Z - Done responding to the client null

$ nx report

 >  NX   Report complete - copy this into the issue template

   Node : 16.16.0
   OS   : linux x64
   yarn : 1.22.17
   
   nx : 15.0.13
   @nrwl/angular : Not Found
   @nrwl/cypress : 15.0.13
   @nrwl/detox : Not Found
   @nrwl/devkit : 15.0.13
   @nrwl/esbuild : Not Found
   @nrwl/eslint-plugin-nx : 15.0.13
   @nrwl/expo : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : 15.0.13
   @nrwl/js : 15.0.13
   @nrwl/linter : 15.0.13
   @nrwl/nest : 15.0.13
   @nrwl/next : Not Found
   @nrwl/node : 15.0.13
   @nrwl/nx-cloud : 15.0.2
   @nrwl/nx-plugin : Not Found
   @nrwl/react : 15.0.13
   @nrwl/react-native : Not Found
   @nrwl/rollup : 15.0.13
   @nrwl/schematics : Not Found
   @nrwl/storybook : 15.0.13
   @nrwl/web : 15.0.13
   @nrwl/webpack : 15.0.13
   @nrwl/workspace : 15.0.13
   typescript : 4.8.4
   ---------------------------------------
   Local workspace plugins:
   ---------------------------------------
   Community plugins:
         @nx-plus/docusaurus: 14.1.0

Ok, I found some docs on the Daemon: https://nx.dev/guides/nx-daemon

The workaround:

export NX_DAEMON=false; or in nx.json in tasksRunnerOptions.options you can disable the daemon: "useDaemonProcess": false.

Happy to help debugging this and enable the daemon anytime to tests fixes!

This reply by @Nightbr seem to be working for me , thank you for the support sir!

Up

Up

In my case, I mount database data volumn of db image to a local folder, and that folder is created with sudo right. when I start application with nx serve, it has this error. Worked after I fix the access right of my local folder

Up

Super random - been using NX for about a year, just started using Docker/containers about 2 mths ago - today I started getting this error with the projecr graph and my nx builds fail in Docker

Fedora, using the latest version

> nx run ddmaster:build

Compiling TypeScript files for project "ddmaster"...
Done compiling TypeScript files for project "ddmaster".

 ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 >  NX   Successfully ran target build for project ddmaster



 >  NX   Bad file descriptor

   
   Because of the error the Nx daemon process has exited. The next Nx command is going to restart the daemon process.
   If the error persists, please run "nx reset".

Error: Bad file descriptor

[NX Daemon Server] - 2023-02-13T20:43:20.245Z - Started listening on: /tmp/8a4231574ca554ceae54/d.sock
[NX Daemon Server] - 2023-02-13T20:43:20.254Z - Established a connection. Number of open connections: 1
[NX Daemon Server] - 2023-02-13T20:43:20.255Z - Established a connection. Number of open connections: 2
[NX Daemon Server] - 2023-02-13T20:43:20.257Z - [REQUEST]: Client Request for Project Graph Received
[NX Daemon Server] - 2023-02-13T20:43:20.279Z - [REQUEST]: Updated file-hasher based on watched changes, recomputing project graph...
[NX Daemon Server] - 2023-02-13T20:43:20.534Z - Time taken for 'hash changed files from watcher' 0.07755699986591935ms
[NX Daemon Server] - 2023-02-13T20:43:20.535Z - Closed a connection. Number of open connections: 1
[NX Daemon Server] - 2023-02-13T20:43:20.537Z - [WATCHER]: Unexpected workspace watcher error Bad file descriptor
[Error: Bad file descriptor]
[NX Daemon Server] - 2023-02-13T20:43:21.100Z - [REQUEST]: Responding to the client. project-graph
[NX Daemon Server] - 2023-02-13T20:43:21.103Z - Time taken for 'total for creating and serializing project graph' 842.7955730003305ms
[NX Daemon Server] - 2023-02-13T20:43:21.105Z - Done responding to the client project-graph
[NX Daemon Server] - 2023-02-13T20:43:23.589Z - [REQUEST]: Responding to the client with an error. File watcher error in the workspace '/home/cristian/IdeaProjects/base-monorepo-nodejs'. Bad file descriptor
[Error: Bad file descriptor]
[NX Daemon Server] - 2023-02-13T20:43:23.590Z - Done responding to the client null

Upgraded to node v16.14 + Nx 14.5.4, clear node_modules and reinstall still have the error:

Error: Could not deserialize project graph.
Message: Unexpected end of JSON input


Received:


Messages from the log:
[NX Daemon Server] - 2022-08-11T12:19:55.339Z - Started listening on: XXX/node_modules/.cache/nx/d/d.sock
[NX Daemon Server] - 2022-08-11T12:19:55.357Z - [REQUEST]: Client Request for Project Graph Received
[NX Daemon Server] - 2022-08-11T12:19:55.361Z - [REQUEST]: Updated file-hasher based on watched changes, recomputing project graph...
[NX Daemon Server] - 2022-08-11T12:19:55.429Z - Time taken for 'hash changed files from watcher' 0.07947099953889847ms

 >  NX   Bad file descriptor


More information:XXXX/node_modules/.cache/nx/d/daemon.log
    at daemonProcessException (XXX/node_modules/nx/src/daemon/client/client.js:66:16)
    at Socket.<anonymous> (XXX/node_modules/nx/src/daemon/client/client.js:188:32)
    at Socket.emit (node:events:538:35)
    at endReadableNT (node:internal/streams/readable:1345:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
 >  NX   Report complete - copy this into the issue template

   Node : 16.14.2
   OS   : linux x64
   yarn : 1.22.17
   
   nx : 14.5.4
   @nrwl/angular : Not Found
   @nrwl/cypress : 14.5.4
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.5.4
   @nrwl/eslint-plugin-nx : 14.5.4
   @nrwl/express : Not Found
   @nrwl/jest : 14.5.4
   @nrwl/js : 14.5.4
   @nrwl/linter : 14.5.4
   @nrwl/nest : 14.5.4
   @nrwl/next : Not Found
   @nrwl/node : 14.5.4
   @nrwl/nx-cloud : 14.3.0
   @nrwl/nx-plugin : Not Found
   @nrwl/react : 14.5.4
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.5.4
   @nrwl/web : 14.5.4
   @nrwl/workspace : 14.5.4
   typescript : 4.7.4
   ---------------------------------------
   Community plugins:
         @nx-plus/docusaurus: 12.2.0

WORKAROUND:

In nx.json you can still disable the daemonProcess:

  "tasksRunnerOptions": {
    "default": {
      "runner": "@nrwl/nx-cloud",
      "options": {
         ...
        "useDaemonProcess": false
      }
    }
  },

Up

I noticed that this error happened when I have quite a lot (~1000) of uncommited changes.

@FrozenPandaz - No it does not. I had to turn off daemon server locally for commands to run again

Does running nx reset fix the issue?