Cnoob
Cnoob

Reputation: 191

VS Code cannot find Arduino IDE path

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?

Upvotes: 4

Views: 21812

Answers (8)

The Little Cousin
The Little Cousin

Reputation: 442

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.

Edit: Your main sketch filename must be exact name to your root directory name.

Folder (arduino-vs-test) Sketch (arduino-vs-test.ino)

Upvotes: -1

K417s
K417s

Reputation: 11

I use Windows and I solved it as follows.

The problem is because you are using the new version Arduino IDE 2.x.x and it has another way to code its sketches and more (I don't know how to say it, I'm a beginner in this) or you haven't activated to use Arduino Cli at least, so -- ->

  1. Intall Arduino 1.8.x. You can donwload it here: Arduino Software
  2. Open your vscode, go to Files>preferences>settings and find your Arduino extension under "Extensions". and put the standard path for Arduino 1.8.x like: C:\Program Files (x86)\Arduino (Remember this is where you installed the Arduino 1.8.x path) in "Arduino Path".
  3. Next, you need to click on "Arduino: Use ArduinoCli" to link the Arduino extension to the correct version (Arduino Legacy is not allowed). Arduino CLI option in vscode settings

Upvotes: 1

mister-sir
mister-sir

Reputation: 135

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, but be sure to update the version number to whatever is installed on your system.

Upvotes: 3

tomdelahaba
tomdelahaba

Reputation: 1048

Even when its on mac, someone can find this helpful as I had the same problem and found this thread. On MAC I have solved this one with arduino-cli and following:

  1. install homebrew (if you have, proceed to step 2)
  2. install arduino-cli with brew install arduino-cli
  3. find where the arduino-cli is installed. Usually (on mac) it will be /opt/homebrew/bin/arduino-cli... Which means, if you run the command arduino-cli, it will execute this script... You can find the location with: which arduino-cli (I have zsh, I am not aware if it will be the same for older bash, probably it will, I am not so skilled in this one, but you can try to use find instead of which. But which is working for me
  4. lets assume you have the path, for me it was /opt/homebrew/bin/arduino-cli
  5. proceed to VScode, go to settings (well, lets assume we will be working with the json settings
  6. in my case, the input is following:
    "arduino.useArduinoCli": true,
    "arduino.path": "/opt/homebrew/bin/",
    "arduino.commandPath": "arduino-cli"

Note, even when the path to arduino-cli is /opt/homebrew/bin/arduino-cli, we are removing the script name from the path... But we are adding this to the commandPath

Upvotes: 8

rayan4444
rayan4444

Reputation: 31

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)

Upvotes: 0

Muhammed Salem
Muhammed Salem

Reputation: 51

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

Upvotes: 0

jort57
jort57

Reputation: 76

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.

Upvotes: 0

Prateek Kumar Singh
Prateek Kumar Singh

Reputation: 161

  • 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.

Upvotes: 8

Related Questions