nx-console icon indicating copy to clipboard operation
nx-console copied to clipboard

Failed to reset the Nx workspace due to lock

Open siiron opened this issue 11 months ago • 2 comments
trafficstars

Current Behavior

When running nx reset the plugin prevents this due to lock on the nx cache db.

Expected Behavior

The nx reset should be able to complete

Steps to Reproduce

Install IntelliJ

IntelliJ IDEA 2024.3 (Ultimate Edition) Build #IU-243.21565.193, built on November 13, 2024

Install latest NX Console plugin 1.33.0

Run nx reset on a monorepo workspace

Failure Logs / Images / Videos

Failed to reset the Nx workspace. Failed to clean up the workspace data directory. Error: EBUSY: resource busy or locked, unlink 'C:\Projects\path-to-project\.nx\workspace-data\54bcfc73-8e5b-493f-bfc2-a6f8e81a6bda.db' node:fs:2368 return binding.writeFileUtf8( ^

Error: ENOENT: no such file or directory, open 'C:\Projects\path-to-project\.nx\cache\terminalOutputs\4925364787582055960' at writeFileSync (node:fs:2368:20) at ForkedProcessTaskRunner.writeTerminalOutput (C:\Projects\path-to-project\node_modules\nx\src\tasks-runner\forked-process-task-runner.js:311:32) at ChildProcess. (C:\Projects\path-to-project\node_modules\nx\src\tasks-runner\forked-process-task-runner.js:239:26) at ChildProcess.emit (node:events:519:28) at ChildProcess._handle.onexit (node:internal/child_process:294:12) { errno: -4058, code: 'ENOENT', syscall: 'open', path: 'C:\Projects\path-to-project\.nx\cache\terminalOutputs\4925364787582055960' }

Node.js v20.16.0

Environment

  • Nx Console version: 1.33.0
  • IntelliJ IDEA 2024.3 (Ultimate Edition)
  • Windows 11

siiron avatar Dec 04 '24 17:12 siiron

Hey :) Thanks for the report. Could you please provide your nx report results? This sounds like an issue with nx itself more than Nx Console, right? You're running nx reset via the CLI?

MaxKless avatar Dec 05 '24 10:12 MaxKless

I use the NX Console, and runs tasks through it in IntelliJ. Here is a typical workflow:

1. Perform a clean build using NX Console = SUCCESS

Image

2. Try nx reset from Windows terminal using CLI = SUCCESS

Image

3. Perform another clean build using NX Console = SUCCESS, then try to do nx reset via NX Console = FAIL

Image

4. Try nx reset from Windows Terminal using CLI = SUCCESS.

Image

Please note that if I disable NX Console plugin in IntelliJ I still can perform the reset via IntelliJs terminal. The error only appears when running the task from the plugin.

Herer is results of NX report:

NX Report complete - copy this into the issue template

Node : 20.16.0 OS : win32-x64 Native Target : x86_64-windows npm : 10.8.1

nx : 20.1.4 @nx/js : 20.1.4 @nx/jest : 20.1.4 @nx/eslint : 20.1.4 @nx/workspace : 20.1.4 @nx/cypress : 20.1.4 @nx/devkit : 20.1.4 @nx/eslint-plugin : 20.1.4 @nx/next : 20.1.4 @nx/playwright : 20.1.4 @nx/react : 20.1.4 @nx/storybook : 20.1.4 @nx/vite : 20.1.4 @nx/web : 20.1.4 @nx/webpack : 20.1.4 typescript : 5.7.2

Community plugins: @jscutlery/semver : 5.3.1 nx-stylelint : 18.0.0

siiron avatar Dec 05 '24 16:12 siiron