nvm-windows: exit status 145: The directory is not empty , when I run command : nvm use 16.10.0
Issue:
My computer info :
OS : windows 10 Terminal : PowerShell
nvm-windows install directory : D:\apps\nvm-windows\nvm
after install nvm-windows , check the nvm command location :
` PS D:\apps\nvm-windows\nvm\v12.18.2 get-command nvm
CommandType Name Version Source
Application nvm.exe 0.0.0.0 D:\apps\nvm-windows\nvm\nvm.exe
`
check the current nvm env :
` PS D:\apps\nvm-windows\nvm\v12.18.2 nvm current
v12.18.2 `
check the list command
` PS D:\apps\nvm-windows\nvm\v12.18.2 nvm list
16.10.0
12.18.2 (Currently using 64-bit executable)`
When switch to latest version : 16.10.0
` PS D:\apps\nvm-windows\nvm\v12.18.2 nvm use 16.10.0
exit status 145: The directory is not empty. `
The error message " exit status 145: The directory is not empty. " , is not clear meaning for which directory is not empty , because the directory underline I running the command " nvm use 16.10.0 " , is a new directory and is empty .
This is the first time I install nvm-windows on my computer , windows 10 .
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 6
- Comments: 53 (8 by maintainers)
For me the issue was “C:\Program Files (x86)\nodejs” folder was indeed non-empty after uninstalling nodejs. Deleting that folder than “nvm use …” worked.
@almogoha That worked for me too. Nice! Deleted the
C:\Program Files\nodejs
in my case.Try
1 - Uninstall the node js application from your computer 2 - If there is a
nodejs
file in the program files, delete it 3 - try and see.On a Windows machine I simply navigated to C:\Program Files\nodejs. I then renamed that folder to C:\Program Files\nodejsx\ (or anything else). After that I was able to run “nvm use v.v.v.” to downgrade to the version of npm I needed. You can also just delete the folder but I opted to just rename it. As a side-note, I’m on a 32-bit machine, so I needed to indicate that specifically in my use version command using this format: “nvm use 16.14.0 32”.
Still not resolved.
Uninstall any existing nodejs version and install using nvm install v.v.v
When I run ‘nvm use 14.18.0’ without it installed it says : node v14.18.0 (64-bit) is not installed.
Once I run ‘nvm install 14.18.0’, it went through smoothly. And there is ‘v14.18.0’ folder downloaded in the directory.
Then I run ‘nvm use 14.18.0’ and now it says: exit status 145: The directory is not empty.
Not sure whats wrong here. I changed a few installation directory, avoided folder name with space and it is still the same problem.
In my case renaming “C:\Program Files\nodejs” to “C:\Program Files\nodejs2” helped. Then nvm recreated “\nodejs” as simlink. Just as the error said “directory not empty” : )
This happened to me after deleting my node cache in app data and subsequently uninstalling/reinstalling node.js.
Reinstalling NVM fixed this.
This is sooo helpful and it saved my night!!!
I have solved this problem. There can be no spaces in the installation directory of NVM and the installation directory of nodejs. Then, open the CMD command line as an administrator and execute NVM use * * *. I have solved this problem with this method!!!
I have installed node manually then installed nvm. So I uninstalled node and then installed viw nvm. Problem solved
It worked for me too 🥳 💘
Since yesterday I’m with this error, and just deleted the nodejs folder solved it 😃
@all Friends, when you got exit status 145: The directory is not empty. Because you had install node.js. If You wanted to resolve the question, please uninstall node.js first. Secondly,install nvm and then perform your steps you had performed.

@hmadamk Unfortunately I’m not sure that is an option for me as this is running on a pre-generated VM on my CI/CD provider’s side. I’m still investigating, though.
I do feel that
nvm use
should work regardless of my existing setup, but maybe @coreybutler has a reason this isn’t the case. But it seemed like they thought it was an issue (and thought it was fixed!)Just for transparency, proof its 1.1.9:
@andrewjhanlon Thanks. It helps me after changing the name of the node directory.
@coreybutler this is still happening on 1.1.9, at least for 32-bit. In my case (an Azure Pipelines agent), removing the nodejs folder doesn’t work either, so the solution was to downgrade to 1.1.7.
Even if it has to be solved manually, the error message should be changed to something more explicit. In addition, I believe
nvm use
is not returning a non-zero exit code here, as I’m running this from Git-Bash withset -e
and the script continues normally (until something breaks further ahead).I ran nvm setup program again and changed back to C:\Program Files for simulink location and it solved my problem. I’m using v1.1.8. It seems space doesn’t affect v1.1.8, however you can’t put simulink in an arbitrary folder.
You don’t need to switch to any particular directory to use the nvm.exe or node.exe files… NVM4W handles all the paths for you.
I suspect the reason you were originally unable to switch the version is because you ran the command from the same location that was being modified.
In other words, don’t run
nvm use 16.10.0
when the console is usingD:\apps\nvm-windows\nvm\v12.18.2
. Instead, navigate to any other directory to runnvm use x.x.x
. For example, open powershell or terminal and navigate to:C\
orD:\
, then runnvm use 16.10.0
.