VS Code cannot find Arduino IDE path

Viewed 8930

I have been trying to use the Arduino extension for VS Code in Ubuntu 18, but when I execute the initialize command, I get the error "Cannot find the Arduino IDE. Please specify the arduino.path in the user settings". So I wrote every path that comes out when executing the command "whereis arduino", I've also tried leaving the box empty (in theory that makes VS Code search for the IDE) and reinstalling both the Arduino IDE and VS Code several times, without any result. Does somebody knows a possible fix for this issue?

6 Answers
  • Download and extract the appropriate Arduino version according to your need from here, and install it using command sudo ./install. In my case, I have downloaded Arduino 1.8.6 Linux 64 Bit .
  • Goto Files -> Preferences -> Settings, Open Settings(JSON) as shown below. Open Settings(JSON)
  • Change arduino.path to the path location of extracted Arduino file. In my case it is /home/user/Downloads/arduino-1.8.6 and arduino.commandPath to arduino.
    OR
    For those who installed Arduino through snap platform refer this post.
  • Your Settings JSON file should look like this.
{
    "arduino.path": "/home/user/Downloads/arduino-1.8.6",
    "arduino.commandPath": "arduino",
}
  • Save and restart.
    It's Done!!
    Good Luck
    P.S.:Add arduino.commandPath if not already exist and should point to Arduino executable present in the arduino.path.

I found that running whereis arduino or which arduino gave me /usr/local/bin/arduino. However, this didn't make Visual Studio Code happy. After some more digging, it turns out that that path is just a symlink to /opt/arduino-1.8.13. (Use ls -la /usr/local/bin/arduino to see where the symlink points to on your system.)

Also of note: be sure to give the path to the directory, not to the actual executable. For instance, in my case, the proper path was /opt/arduino-1.8.13 NOT /opt/arduino-1.8.13/arduino!

tl;dr

Use /opt/arduino-1.8.13/arduino, but be sure to update the version number to whatever is installed on your system.

This might not work for everyone, but the problem for me was using Visual Studio Code for flatpak. There was probably a better way to fix this, but the easiest way to do it (for me) was to install the binary from their website.

Go to "User Settings" > "Extensions" > "arduino.commandPath" > change it to "arduino_debug.exe"

In my case whereis arduino gave me /usr/bin/arduino and /usr/share/arduino, however putting either of them in the arduino.path didn't work. Entering /usr/bin did the trick though. hope it helps! (Ubuntu 20.04)

Here's what fix my issue!

1st - Make sure you have the right path ("The path to the folder which contains the 'arduino.exe'", and not the path with the 'arduino.exe') copied to your Arduino Settings in VS Code.

2nd (The Actual Fix for me) - After installing the Arduino IDE and the VS Code extension RESTART you entire computer!! This somehow updates the Registry.

After which you can just Initialize your project, F1 - Arduino Initialize. That's it enjoy and start up your Golden IoT project.

Related