Cargo : Command Failed (OS Error 5)

Hello everyone
I have a problem on my computer with cargo.
I've installed rust via the rustup-init file (Install Rust - Rust Programming Language) and when I want to check if cargo is correctly installed, there is an issue :

I've checked the. cargo folder and there are all the other components.

Do you have any clue or idea to solve this problem?

Thanks !

Did you install Rust using a different account?

I didn't need an account to install rust

Did you install it on a different user account of your system? Maybe you installed under your regular account, but are trying to run it as Adminstrator now.

I can't log as an administrator because it is my office computer but when I run the cmd or the installation file as an administrator, it is the same case

You shouldn't run cargo as administrator. You should run it as your regular user.

Did you log out and then log back in?
rustup sets some environment variable in my .bashrc file on linux. The first install I had to logout and back in again to get my configs working. PATH and stuff.
I think windows might do the same?

I would check where cargo to see if it's trying to run the cargo you expect next? If not you will have to check for bad %PATH% entries, but if you're not using multiple accounts that's but likely to be the reason.

You could try navigating to that path (in Windows or the command prompt) to see if you are being denied access to some directory along the path.

It would also be handy to check icacls c:\path\to\cargo.exe to see the full set of permissions. You should have a grant for X, and no denies.

After a night with my computer power down, I tried to do a chmod -R 777 on my cargo folder and it is now working. Thank's all !

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.