-
Notifications
You must be signed in to change notification settings - Fork 214
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
Plugin interferes with the deletion of the node_modules #1863
Comments
I know exactly why this happens. It's because of the daemon holding on to the binary file within node_modules. It's a tough issue to solve, and I couldn't think of a way to handle this that isn't a hack. The simplest way right now is to make sure to stop the daemon first with |
@Cammisuli and what do you do in non nx projects ? there is no nx installed |
The language server will just live and do nothing. It wont be able to get nx projects if there's no nx daemon. |
@Cammisuli im not sure what you mean - i have the same problem, that nx console create the locked file in non nx projects and makes it impossible to delete node_module ( or update/install with yarn ) |
are you on the latest version of Nx Console? We released a fix for non-nx projects a while back. |
im on 1.51.1 |
If you do not have Nx as a dependency in your workspace, then the .node file that gets locked shouldn't be there. That file only gets locked when the Nx daemon is running, which Nx Console will start. If the file is there, then there's something that has nx as a dependency, and you can check it with If Nx isn't there, then Nx Console won't be able to start the daemon, and it wont lock any files. |
What if NX will install its binaries in temp folder (e.g. I know this is also a hack, but I guess if done that way — there will be no issues with node_modules being locked by nx daemon 🤔 I've seen a similar pattern in Playwright, where
|
@Cammisuli
Nevertheless, nothing should change the node_modules except the package manager - why dont you use the .nx directory that get created anyway ? |
@Den-dp thats the current plan that we thought of, but we'd have to move the whole node_modules/nx directory because of the way we use the native binaries. @puschie286 ok, that makes sense then. Nothing is being changed in the node_modules folder, its just when the daemon gets started (because we found nx in node_modules) it will load a binary file into its memory. And if that daemon is still being run when trying to clean node_modules, the OS cannot remove the .node binary because its in use. |
Current Behavior
It is impossible to fully remove
node_modules
while in IDEExpected Behavior
Unfortunately, developers in the npm ecosystem are used to removing the
node_modules
folder in some cases.Currently, it is problematic while in IDE because the plugin locks resources in
node_modules/@nx/
.Such adds extra overhead on communicating that IDE must be closed in order to do such things, while theoretically can be solved one time on your side.
Steps to Reproduce
npx create-nx-workspace@latest nx1672
idea nx1672
orcode nx1672
nx reset
(to stop the daemon?)rm -fo -r node_modules
(I'm using powershell)Failure Logs / Images / Videos
Environment
Nx Console: v18.6.0
VSCode: 1.82.0-insider
Nx Console: 1.11.1
IDEA: 2023.2
The text was updated successfully, but these errors were encountered: