PlatformIO Community

[ERROR] All buttons of PlatformIO for VS Code on Ubuntu is disable

I am the first time use PlatformIO for VS Code on Ubuntu, when I copied code into the editor, it was OK, but when I click on “PlatformIO : Build”, “PLatformIO : Upload”, and “PlatformIO : Serial Monitor”, there was no response, Has anyone met these issue?

Screenshot-from-2020-08-21-15-07-29

Does this help?

Cheers,
Norm.

I’m not sure, and I didn’t even know how to test it.

Is there any triggering mechanism on Ubuntu for the buttons to be activated ?

Execute VSCode and open the PlatformIO Home page. Click the button to import an Arduino project.
Navigate to where the Arduino sketch lives. Click OK.
Select a board, Arduino Uno for example, and click IMPORT.
A new PlatformIO project will be created in the default location for PlatformIO projects. It will be named as per the data and time, plus the board name, mine was:

/home/norman/Documents/PlatformIO/Projects/20200821-124038-uno.

Do the buttons work now?

You can find where this project has been saved by opening a new terminal in VSCode (Terminal->New Terminal or CTRL+SHIFT+#) and typing the command pwd.

Next, while still in the terminal, type echo $SHELL you should see /bin/bash, if you don’t, your user is set up to use a different shell from the Bash shell, and that might be the cause.

I think, but I’m not 100% certain, that the “trigger” would be that the PlatformIO Home page is open, you have a project’s directory open (where the platformio.ini file is located), possibly that you need to be using the bash shell, and that should be all.

Having said that, your screen shot doesn’t show the PlatformIO Home page, did you close it? Click on the Alien/bug’s head on the left side toolbar, or on the little house icon on the bottom toolbar, to open it. Do the buttons work now?

Cheers,
Norm.

PS. I’m on Linux Mint 19.3 which is Ubuntu based.

Screenshot-from-2020-08-22-08-53-19

Not quite… exactly as follows:

echo $SHELL

(which will print (echo)the contents of the variable ($) named SHELL), which looks to be bash, judging from the screenshot.

image

So there is no response or errors from the buttons being pressed at all? The PlatformIO extention clearly knows it should be activated for the project, otherwise only the first icon, the PIO Home icon, would be shown on the statusbar.

It may be worth opening the developer tools console (Help -> Toggle Developer Tools, and select the ‘Console’ tab if it isn’t already selected) and seeing if there are any errors reported when you click the Build button. You can also try Ctrl+Shift+B, or the build option under the PlatformIO sidebar panel:
image

Screenshot-from-2020-08-22-10-00-04

RIGHT, there are so many errors here.

“exited with error code 127”

I thought it was because I have created the projects into an error folder, so I made a new one, and deleted the last projects. Now, this is the prompt:

Screenshot-from-2020-08-22-10-22-54

Sorry but I’m not able to read the text on your screenshots I’m afraid. They are blurred when I open them (on my tablet) on the web page and do not scroll or resize on that page (imgbb) - weird. (Mind you, I have Javascript disabled for most web pages on my tablet!)

If I open the image, from the imgbb web page, they are tiny, and impossible to read.

If you need to post code or error text, just copy it please, when pasting into a reply, type three backticks on a separate line, paste the code, the three more backtick. Like this:

```
Paste your error text or code here.
```

It’s easier than using an online image “thing” which seems to minimize your screeshots.

Cheers,
Norm.

[Extension Host] Congratulations, your extension "code-gnu-global" is now active!
2console.ts:137 [Extension Host] Command: global --encode-path " " -f "/home/mq/UNOprojects/demo_LM75/src/main.cpp" running...
console.ts:137 [Extension Host] Error: Error: Command failed: global --encode-path " " -f "/home/mq/UNOprojects/demo_LM75/src/main.cpp"/bin/sh: 1: global: not found `global --encode-path " " -f "/home/mq/UNOprojects/demo_LM75/src/main.cpp"` (exited with error code 127)
t.log @ console.ts:137
console.ts:137 [Extension Host] undefined
console.ts:137 [Extension Host] Error: Error: Command failed: global --encode-path " " -f "/home/mq/UNOprojects/demo_LM75/src/main.cpp"/bin/sh: 1: global: not found `global --encode-path " " -f "/home/mq/UNOprojects/demo_LM75/src/main.cpp"` (exited with error code 127)
t.log @ console.ts:137
console.ts:137 [Extension Host] undefined
console.ts:137 [Extension Host] activating extension
console.ts:137 [Extension Host] starting language server
console.ts:137 [Extension Host] Command: global --encode-path " " -f "/home/mq/UNOprojects/demo_LM75/src/main.cpp" running...
console.ts:137 [Extension Host] Error: Error: Command failed: global --encode-path " " -f "/home/mq/UNOprojects/demo_LM75/src/main.cpp"/bin/sh: 1: global: not found `global --encode-path " " -f "/home/mq/UNOprojects/demo_LM75/src/main.cpp"` (exited with error code 127)
t.log @ console.ts:137
console.ts:137 [Extension Host] undefined
2console.ts:137 [Extension Host] (node:2753) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
t.log @ console.ts:137
console.ts:137 [Extension Host] runCommand platformio Array(1) Object
console.ts:137 [Extension Host] Command: global --encode-path " " -f "/home/mq/UNOprojects/demo_LM75/src/main.cpp" running...
console.ts:137 [Extension Host] Error: Error: Command failed: global --encode-path " " -f "/home/mq/UNOprojects/demo_LM75/src/main.cpp"/bin/sh: 1: global: not found `global --encode-path " " -f "/home/mq/UNOprojects/demo_LM75/src/main.cpp"` (exited with error code 127)
t.log @ console.ts:137
console.ts:137 [Extension Host] undefined
console.ts:137 [Extension Host] Command: global --encode-path " " -f "/home/mq/UNOprojects/demo_LM75/src/main.cpp" running...
console.ts:137 [Extension Host] Error: Error: Command failed: global --encode-path " " -f "/home/mq/UNOprojects/demo_LM75/src/main.cpp"/bin/sh: 1: global: not found `global --encode-path " " -f "/home/mq/UNOprojects/demo_LM75/src/main.cpp"` (exited with error code 127)
t.log @ console.ts:137
console.ts:137 [Extension Host] undefined
console.ts:137 [Extension Host] Command: global --encode-path " " -f "/home/mq/UNOprojects/demo_LM75/src/main.cpp" running...
console.ts:137 [Extension Host] Error: Error: Command failed: global --encode-path " " -f "/home/mq/UNOprojects/demo_LM75/src/main.cpp"/bin/sh: 1: global: not found `global --encode-path " " -f "/home/mq/UNOprojects/demo_LM75/src/main.cpp"` (exited with error code 127)
t.log @ console.ts:137
console.ts:137 [Extension Host] undefined
notificationsAlerts.ts:40 Extensions have been modified on disk. Please reload the window.
onDidChangeNotification @ notificationsAlerts.ts:40
console.ts:137 [Extension Host] Found PIO Core 4.3.4
1 Like

The errors were in red, but when I pasted them, they lost red color:

console.ts:137 [Extension Host] Error: Error: Command failed: global --encode-path " " -f "/home/mq/UNOprojects/demo_LM75/src/main.cpp"/bin/sh: 1: global: not found `global --encode-path " " -f "/home/mq/UNOprojects/demo_LM75/src/main.cpp"` (exited with error code 127)

Is this clear ?

I am clutching at straws here, as I don’t know what is causing that

error, but do you have any other extensions installed on VSCode? And how did you install VSCode - is it running nativly, or via a Snap package? As I seem to remember hearing that VSCode was acting weirdly in Snap (or was it Flatpak? :open_mouth: ).

Thanks.

Losing the red colour is not a problem, trust me. Your pasted screenshot is perfectly clear.

I’m puzzled by the “global” command. I don’t recall seeing it before. Hmmm. Unless it’s to do with the message your extension “code-gnu-global” is now active at the start.

[Insert quick google search here]

Ok, that is a C++ extension for VSCode, amongst others. I don’t recall it being needed by PlatformIO - but happy to be corrected. I wonder if it is interfering.

Do the buttons work if you disable that extension? You might need to restart the editor, I’m not sure.

Cheers,
Norm.

It might be that. I’m not remember clearly.

I installed only these 3 extensions, when I installed Arduino extension just now, VS Code prompted there was an extension conflict, ant when I selected the suggestion, it uninstalled Arduino.

Here, I found the “global”:

I uninstalled it, it was the same, so maybe I need to reinstall VS Code, this time not via SNAP.

Hmm, snap. I believe that does cause problems.

Beware! I’m also told that when you apt get on Ubuntu to install some stuff, it sneakily uses snap instead. I’m on Linux Mint which doesn’t like/use snaps.

I suspect for VSCode, you can download a *.deb file and install it with apt or dpkg. Good luck.

Cheers,
Norm.

1 Like

Yes, it was it. I removed VS Code and installed it again, I then installed Arduino extension first and verified and uploaded blink.ino, it was OK. Since it was prompted that there was conflict between Arduino extension and PlatformIO extension, so I uninstalled the previous one and installed the latter one, this time, for ensuring it was really work, I modified the blink.ino file and it was also verified and uploaded.

Where I found the installation and uninstall method were here:

  1. uninstall:
    https://askubuntu.com/questions/771334/how-do-i-uninstall-visual-studio-code
  2. install:
    https://linuxize.com/post/how-to-install-visual-studio-code-on-ubuntu-20-04/

[IMPORTANT]Notes:
1.Don’t use snap method, use apt method.
2.After I uninstalled VS Code and installed it by the apt method immediately, the extension I installed before removal was already there, so I made a reboot between uninstall and install.
3.When I still couldn’t built project, I opened a new terminate, and “mkdir --> cd --> code”, then “creat a new project” in PlatformIO.

1 Like

Whats more, I modified the Arduino blink.ino, since I don’t want to use its delay() function, but the LED blinked not evenly, that means sometimes, there was longer darkness and brightness than other duration.

Anyone here advice?

Since I could only upload image now, so I add the code here, one could download into locale for viewing:

#include <Arduino.h>

unsigned long duration = 1000;
unsigned long durationDark = 0;

void setup() {
  // put your setup code here, to run once:
  pinMode(13, OUTPUT);

}

void loop() {
  // put your main code here, to run repeatedly:
  if(millis() - duration >= 1000) {
    digitalWrite(13, HIGH);
    duration = millis();
  }

  if(millis() - durationDark >= 1000) {
    digitalWrite(13, LOW);
    durationDark = millis();
  }