"nvm use 16.13.0" will return this error "exit status 145: The directory is not empty."

Viewed 30147

I have 2 versions of node.js , as follow:-

Your environment has been set up for using Node.js 17.1.0 (x64) and npm.

C:\Windows\System32>nvm list

    16.13.0
    8.16.2

but when i try to use the first version i got this error:-

C:\Windows\System32>nvm use 8.16.2
node v8.16.2 (64-bit) is not installed.

and when i try to use the second version i got this:-

C:\Windows\System32>nvm use 16.13.0
exit status 145: The directory is not empty.

so what is going on? thanks

6 Answers

if it is a Windows machine go to C:\Program Files\nodejs. Then rename that folder to C:\Program Files\nodejsx. After that please check "nvm use v.v.v."

I just fixed it by uninstalling Node.js from the Settings -> Apps menu. According to the https://github.com/coreybutler/nvm-windows/pull/615 pull request, nvm cannot change the version because it's conflicting with the normally installed Node.js version. Try deleting Node.js from the Apps settings menu.

When this happen:

C:\Windows\System32>nvm use 16.13.0
exit status 145: The directory is not empty.

Just make sure, the nodejs folder is empty, check C:\Program Files\nodejs or C:\Program Files (x86)\nodejs, otherwise delete the content. Then try again nvm use XXXX (xxxx is the version)

I meet same issue. I have resolved as:

Make sure you delete all old nodejs.

step 1:uninstall nodejs and remove node_home and npm_home;

step 2: download nvm and Install it. My OS is win, so link is : https://github.com/coreybutler/nvm-windows/releases. if your OS is MAC or Linux, you can use brew or apt install utils to install.

step3: open cmd.exe, run it as "administrator", checking NVM_HOME and NVM_SYMLINK example:

NVM_HOME=D:\dev\node\nvm
NVM_SYMLINK=D:\dev\node\nodejs

Note:make sure nvm home and nvm symlink need in diff forlder.

if not set , your must set manual and add path:

%NVM_HOME%
%NVM_SYMLINK%

open a new cmd.exe terminal, and make sure these is OK.

step 4: Open new terminal prompt:

run 'nvm on'
run 'nvm list'
run 'nvm install 14'
run 'nvm use 14.18.2'
run 'node --version'

enter image description here enjoy it.

On windows 10, It fixed after I uninstalled my node.js application from control panel. And install specific version with nvm install x.x.x then nvm use x.x.x using Powershell in administration mode.

suggest you uninstall local nodejs from control panel and try again nvm use *******

Related