Last updated: May 10, 2023
Reading time·3 min
The NVM error "exit status 145: The directory is not empty" occurs for multiple reasons:
C:\Program Files (x86)\nodejs
or C:\Program Files\nodejs
nodejs
folder after uninstalling Node.js.exit status 145: The directory is not empty exit status 1: Access is denied
In order to use NVM on Windows, you have to make sure that Node.js is not installed on your machine.
If you have a prior version of Node.js installed, it may cause the error because NVM doesn't have permission to remove it.
nodejs
installation at the following locations:C:\Program Files (x86)\nodejs
C:\Program Files\nodejs
nodejs
folder at the specified locations, rename it.C:\Program Files (x86)\nodejs -> C:\Program Files (x86)\nodejsx C:\Program Files\nodejs -> C:\Program Files\nodejsx
nvm
command.nvm install 18.16.0 nvm use 18.16.0
If the issue persists, delete the folder you just renamed, e.g.
C:\Program Files (x86)\nodejsx
or C:\Program Files\nodejsx
.
You should also delete the following folders if they exist on your machine.
# 👇️ delete the following folders (if you have them) C:\Program Files (x86)\Nodejs C:\Program Files\Nodejs C:\Users\{User}\AppData\Roaming\npm C:\Users\{User}\AppData\Roaming\npm-cache C:\Users\{User}\.npmrc C:\Users\{User}\AppData\Local\Temp\npm-*
Try to run your nvm
command after making sure that the folders don't exist.
nvm install 18.16.0 nvm use 18.16.0
The NVM error "exit status 145: The directory is not empty" usually means that one of the following folders:
Is not empty and NVM doesn't have permission to overwrite it.
If the error persists and you have an existing Node.js installation, try to uninstall Node using the official installer.
Check out the following article if you need a step-by-step illustrated guide on how to uninstall Node.js.
You can also look for an existing Node.js installation in the Apps & Features menu:
Start the application.
Search for Node.
If you see Node.js, then click on the application and select Uninstall.
You can also try to uninstall Node.js using the Control Panel:
Look for Node.js in the list of programs.
Right-click on it and select Uninstall.
If you need a step-by-step guide on how to install NVM on Windows, click on the link and follow the instructions.
If the issue persists, try to run CMD (Command Prompt) as an administrator.
Click on the Search bar and type CMD.
Right-click on the Command Prompt application and click "Run as administrator".
nvm
command in the admin shell.nvm install 18.16.0 nvm use 18.16.0
If the issue persists, try to enable your device for development.
Start the application.
Turn on Developer mode by switching on the toggle.
Confirm if you get prompted.
nvm
command in the admin shell.nvm install 18.16.0 nvm use 18.16.0
If the error persists, follow the step-by-step instructions on how to install NVM on Windows in this article.
You might have installed NVM using an incorrect path or you might've installed an older version of NVM that has issues with creating symbolic links.
Following the instructions in this article should resolve the issue.
To solve the NVM error "exit status 145: The directory is not empty", make sure:
C:\Program Files (x86)\nodejs
or
C:\Program Files\nodejs
directories.You can learn more about the related topics by checking out the following tutorials: