user17737438
user17737438

Reputation:

"Setup was unable to create the directory" error for my Visual Studio Code

My Microsoft Visual Studio Code automatically checks for updates every time it opens, but every time it opens, it will run the update and get an error. I know that the "check for updates" is causing it because it gives me an error if I click it.

I know that others mentioned to run the program as an admin. The problem is it creates a new user folder instead of updating the software in my current directory. More explanations are below.

If I click check for updates, it will cause an error

Below is the error. If you look carefully, this tells us that it is trying to create a new user directory, Ronel Priela. The only user directory I use contains a name with an underscore which is Ronel_Priela. This problem has never occurred to me before.

error

A few months ago. I made a lot of changes to my user folder name. It was "Ronel Priela" before. Since it was a folder with spacing on its name, it caused problems for my coding. So I changed my user folder and account name to "Ronel_Priela" which was successful. Do you think messing with my user folder before caused all this?

I don't see anything wrong with my environment variables as well.


Upvotes: 9

Views: 19391

Answers (5)

Abhi Ram
Abhi Ram

Reputation: 1

  1. Do not change installation directory and keep it to recommended path. It helped me.
  2. I tried to download it in Program Files but faced similar error.

Upvotes: 0

Widegrid
Widegrid

Reputation: 1

I had the same issue. I didn't have the 'Code' folder in C:\Users\AppData\Roaming. I just ran the C:\Users\AppData\Local\Programs\Microsoft VS Code\unins000.exe with my current install and the error message no longer appears.

Upvotes: 0

Asen Geshev
Asen Geshev

Reputation: 147

There is a simple solution:

  1. Go to C:\Users<UserName>\AppData\Roaming and delete the Code.
  2. Go to C:\Users<UserName>\AppData\Local\Programs\Microsoft VS Code'and run unins000.exe.
  3. Download and install 'Visual Studio Code'.
  4. Go to the Recycle Bin and restore the Code.

Upvotes: 15

Abhijeet Bundela
Abhijeet Bundela

Reputation: 21

It actually happens because you changed the Users folder name I have the same issue, I'm trying to find the solution but one solution that will work is reinstalling the VS code, I still have to find if anything else will work here.

Edit: So the solution is just to update the VS Code or download the new (or same) version from the web and install it and click on the Path (or create path probably) checkbox while installing, it'll solve the issue.

Upvotes: 2

kayla
kayla

Reputation: 21

I just had the same problem and could not uninstall through the Control Panel or Programs and Features because it kept linking back to the old user name and saying that it had already been uninstalled. I navigated to the location of Visual Studio code and used the uninstall script there. Also to note, which may be the piece that actually fixed it (maybe try this first): I deleted the folder "Code" in "C:\Users<UserName>\AppData\Roaming" and then uninstalled.

In the Start Menu, search for Visual Studio Code, In the right side of the menu where it displays the app, click "Open File Location" (you may have to click the arrow to see all options). For me that opened another VS Code shortcut, so right click and select "Open File Location" again. Mine opened in "C:\Users<UserName>\AppData\Local\Programs\Microsoft VS Code". I then opened the "unins000.exe" and that successfully uninstalled. From there, I reinstalled and it hasn't had any problems since.

During the install, it prompted for the correct user directory (I think this is what you're referring to in your comment) and when I clicked next, it warned me that the folder exists, but I can proceed anyway.

Upvotes: 2

Related Questions