Seems to be slightly related to #664
Clicking the button does nothing, no menu pops up.
I had to manually add a line
"port": "/dev/ttyUSB0"
to ./vscode/arduino.json, after which at least upload works, but opening serial monitor fails with:
Failed to open serial port /dev/ttyUSB0 due to error: + TypeError: Cannot read property 'close' of null
OS: Arch Linux
code 1.33.1
arduino 1.8.9
There are no issues with serial when using the Arduino IDE.
First of all, disclaimer: I am using the stupidest, most cutting edge setup which may or may not totally break this (Using vscode-remote with WSL on Windows, and passing through COM1 to /dev/ttyS1).
I have a similar issue: Before adding "port": "/dev/ttyS1", neither port selection nor the serial monitor worked and I couldn't upload anything to the MKR1000 on COM1.
Triggering either Select Serial Port or Open Serial Monitor terminated the extension host and even made me restart VSCode with WSL totally to regain any functionality.
They still do, but since adding the port I still can't open the serial monitor.
Workaround for this is to cat /dev/ttyS1 either in the built in or the external terminal, but having this functionality from the extension would be way better.
I know this is a quite loaded issue, and it reeks of preview software. Still I'd be grateful for any help!
@C0rn3j I don't know if this helps you, but instead of relying on the Arduino Extension you can try to set up some tasks in .vscode/tasks.json
I cobbeled this together yesterday to help alleviate most of my issues with the Arduino Extension like crashes when selecting a port.
It relies on the arduino ide's basic command line options that have been made available since version 1.5
@C0rn3j I've tried to launch VScode and directly press F1 to select "Arduino: Select Serial Port", it will show error like your description.
But seems it is usage steps different.
May I know your previous steps? Have you created project or open any example? Because when I open an example and click
{
"port": "/dev/ttyUSB0"
}

Could you link the commit which fixes this?
@C0rn3j I got same error in manjaro. Bug reopened. Let me do more investigation and will update you later.
BTW, when you use ArduinoIDE(not in VSC), to do select port, upload, e.g., is everything works well?
Yes, Arduino IDE works without a hitch.
this is definitely still present, I was working on vscode-arduino about 2-3 weeks back without a hitch but I can't select my serial port anymore. Now its either I upload via Arduino IDE or manually input the port into arduino.json.
I do not get any feedback however (no errors) when I hit Select Serial Port. Just nothing
MacOSX 10.14.5
VSCode: 1.36.0
vscode-arduino: 0.2.26
Hi! The same issue here. Can you explain better if some workaround are available?
Can I modify the arduino.json file manually?
I do not get any feedback however (no errors) when I hit Select Serial Port. Just nothing
Can confirm this behavior. At the same time I cannot open the serial monitor on VSCode which is giving me the exact same error depicted in the very first post.
Also, like the first post suggested, I added manually the serialPort into the arduino.json file and at least I'm able to upload the sketch.
I tried opening the Serial Monitor using the Arduino IDE and it opens, but I don't receive any message from the board. (might be a problem on my side probably, not linked with this issue.)
My user has all the permissions to access /dev/ttyUSB0 which is the port where my ESP is connected.
@br1pro As a workaround you can open your terminal and type screen /dev/ttyUSB0 115200.
Change the Baud rate accordingly to your settings of course.
You may have to reset your board once typed the command. It's not the best solution but at least you can open your serial monitor now.
Here's some infos:
Version: 1.36.0
Arduino Version: 1.8.9
Commit: 0f3794b38477eea13fb47fbe15a42798e6129338
Date: 2019-07-03T13:20:56.241Z
Electron: 4.2.5
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Linux x64 4.19.56-1-MANJARO
Same error here. Cannot change or open Serial/COM port in VScode
VSCode serial port issue is not there till may2019 update it started from june 2019 update so to solve the serial port issue with arduino extension I rolled back to the version released on may2019 it is working fine. Remember to make the "update.mode" : "none" in settings.
Is the issue still exist? I am alse not able to reproduce it if use the latest version of Arduino extension and VSCode.
Issue still exists on my installation.
@jerver , have you used the latest Arduino extension 0.2.29 and vscode 1.41.1? And what is your OS version? Is the serial port working properly using Arduino IDE? Because I could not repro the issue, please give more details.
Yeah port is working correctly on Arduino ide but vscode Arduino extension has some issues.
I used latest vscode and arduino extension but no use.
I'm using windows 10 Home basic.
@sreebhargava143, I just tested on windows 10 home x64 edition, the serial port can open and run use Arduino extension. Do you installed the correct hardware USB driver like ST-Link/V2?
Close the issue because it doesn't have recent activity. Please feel free to open a new issue if you would like further discussion. Thank you for your contributions.
Still happens
The issue still exists.
Any luck here, I am pretty much stack now. It used to work.
Any luck here, I am pretty much stack now. It used to work.
Turn automatic updates off or set to manual and downgrade to January 2020 release.
问题依然存在,我重装了几次VSCode也没有解决,正在考虑换一个低版本的。
- 连接我的ESP8266开发板,以便/ dev / ttyUSB0存在
- 创建新文件夹/ tmp / ard并在VSC中打开
- 创建新文件/tmp/ard/something.ino并在VSC中打开它
- 创建/tmp/ard/.vscode/arduino.json,因为选择端口已损坏
{ "port": "/dev/ttyUSB0" }
- 单击“打开串行监视器”图标
2020年3月,我遇到了同样的问题
The bug still exists here in my Windows: Clicking "Select a Serial Port" does noting.
The bug definitely still exists for me as well. Clicking serial port in the lower menu does nothing. Trying to select the serial port from the command pallet also does nothing.
If I manually add the port in my .vscode/arduino.json file I can still upload, but not serial monitoring.
And all of this works fine in my arduino IDE.

Still happening to me with VSCode 1.43.1 and Arduino 0.2.29 on Windows 10.
When I click on the select serial port link, nothing happens. When I manually enter "COM3" into the arduino.json file, I can upload to my ESP32 just fine.
It works fine on my work computer, but not from my home computer (yay COVID-19 shifting my work location).
One thing of note - on my work computer, I had Arduino IDE installed before I installed VSCode and the Arduino extension. On my home computer, I installed VSCode and Arduino extension first, had errors with arduino.path that made me realize I never installed Arduino IDE here, then installed it and hit this issue with the serial port. Maybe the bug only happens if you install those 3 things out of order?
Good: Arduino IDE -> VSCode -> Arduino Extension
Bad: VSCode -> Arduino Extension -> Arduino IDE
Still happening to me too, I have the lastest version of VSCode, Arduino and Ubuntu Linux
This is also an issue for me with the 1.43.1 version.
Rolling back to 1.42.1 fixed my issues with the port selection and Serial Monitor. For reference, if on Debian/Ubuntu-based systems: apt install code=1.42.1-1581432938
Still having this bug, unluckyly the extension is not usable
Why is this issue closed?
A downgrade is not a fix
Had the same problem, fixed it by unpluging a microphone that was plugged in at the time
Still an issue
I had this problem until I updated to the latest version of Visual Studio Code Insiders. Select Serial Port works fine now.
Version: 1.48.0-insider (user setup)
Commit: c9a2f78283b6e5ef708fb8869e2a5adaa476e42f
Date: 2020-07-31T05:52:44.330Z
Electron: 7.3.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.18362
Arduino extention version: v0.3.1
Arduino IDE version 1.8.12
I fixed the problem without switching to the vscode insiders build.
The extension has a couple of modules that have native bindings built for a different version of node/electron.
Install electron-rebuild. I use yarn: yarn global add electron-rebuild.
cd $HOME/.vscode-oss/extensions/vsciot-vscode.vscode-arduino-0.3.2/out/node_modules/usb-detection (change the .vscode-oss path and the version of vscode-arduino accordingly to your environment)
yarn add nan; electron-rebuild -v 9 (9 is the version of electron used by your vscode)
I configured node to install global packages in $HOME/.npm-packages with $HOME/.npm-packages/bin in my PATH. You have to adapt the call to electron-rebuild based on your environment.
cd $HOME/.vscode-oss/extensions/vsciot-vscode.vscode-arduino-0.3.2/out/node_modules/@serialport/bindings; yarn add nan; electron-rebuild -v 9The serial port selection and monitor should work fine now.
@mtorromeo's method solved my problem. Now it's working!
I too have the same issue on windows 10. Had the latest version of vscode 1.49.0. I had to uninstall vscode, downgrade to the 1.42.1 version and uninstall the C++ and arduino plugins, then reinstall arduino which then gets the correct working version of C/C++ plugin its dependent on.
This issue should be reopened as its borked on most newer versions of vscode.
I fixed the problem without switching to the vscode insiders build.
The extension has a couple of modules that have native bindings built for a different version of node/electron.
- Install electron-rebuild. I use yarn:
yarn global add electron-rebuild.cd $HOME/.vscode-oss/extensions/vsciot-vscode.vscode-arduino-0.3.2/out/node_modules/usb-detection(change the .vscode-oss path and the version of vscode-arduino accordingly to your environment)yarn add nan; electron-rebuild -v 9(9 is the version of electron used by your vscode)I configured node to install global packages in
$HOME/.npm-packageswith$HOME/.npm-packages/binin my PATH. You have to adapt the call toelectron-rebuildbased on your environment.
cd $HOME/.vscode-oss/extensions/vsciot-vscode.vscode-arduino-0.3.2/out/node_modules/@serialport/bindings; yarn add nan; electron-rebuild -v 9The serial port selection and monitor should work fine now.
Great, it worked for me 🙂👍
As a workaround:
{
"port":"COM4"
}
@hellyzh Why you're closing this if the issue is still present?!
As a workaround:
- open the folder where your .ino file resides
- open the .vscode folder
- edit arduino.json
- change the port
e.g.{ "port":"COM4" }
Worked for me as a workaround.
Still broken on version 1.49.2
I fixed the problem without switching to the vscode insiders build.
The extension has a couple of modules that have native bindings built for a different version of node/electron.
- Install electron-rebuild. I use yarn:
yarn global add electron-rebuild.cd $HOME/.vscode-oss/extensions/vsciot-vscode.vscode-arduino-0.3.2/out/node_modules/usb-detection(change the .vscode-oss path and the version of vscode-arduino accordingly to your environment)yarn add nan; electron-rebuild -v 9(9 is the version of electron used by your vscode)I configured node to install global packages in
$HOME/.npm-packageswith$HOME/.npm-packages/binin my PATH. You have to adapt the call toelectron-rebuildbased on your environment.
cd $HOME/.vscode-oss/extensions/vsciot-vscode.vscode-arduino-0.3.2/out/node_modules/@serialport/bindings; yarn add nan; electron-rebuild -v 9The serial port selection and monitor should work fine now.
Great, it worked for me
Works Great! , is there any way you can fix the bug permanently without this patch required?
I fixed the problem without switching to the vscode insiders build.
The extension has a couple of modules that have native bindings built for a different version of node/electron.
- Install electron-rebuild. I use yarn:
yarn global add electron-rebuild.cd $HOME/.vscode-oss/extensions/vsciot-vscode.vscode-arduino-0.3.2/out/node_modules/usb-detection(change the .vscode-oss path and the version of vscode-arduino accordingly to your environment)yarn add nan; electron-rebuild -v 9(9 is the version of electron used by your vscode)I configured node to install global packages in
$HOME/.npm-packageswith$HOME/.npm-packages/binin my PATH. You have to adapt the call toelectron-rebuildbased on your environment.
cd $HOME/.vscode-oss/extensions/vsciot-vscode.vscode-arduino-0.3.2/out/node_modules/@serialport/bindings; yarn add nan; electron-rebuild -v 9The serial port selection and monitor should work fine now.
How do I do this in windows? :(
I fixed the problem without switching to the vscode insiders build.
The extension has a couple of modules that have native bindings built for a different version of node/electron.
- Install electron-rebuild. I use yarn:
yarn global add electron-rebuild.cd $HOME/.vscode-oss/extensions/vsciot-vscode.vscode-arduino-0.3.2/out/node_modules/usb-detection(change the .vscode-oss path and the version of vscode-arduino accordingly to your environment)yarn add nan; electron-rebuild -v 9(9 is the version of electron used by your vscode)I configured node to install global packages in
$HOME/.npm-packageswith$HOME/.npm-packages/binin my PATH. You have to adapt the call toelectron-rebuildbased on your environment.
cd $HOME/.vscode-oss/extensions/vsciot-vscode.vscode-arduino-0.3.2/out/node_modules/@serialport/bindings; yarn add nan; electron-rebuild -v 9The serial port selection and monitor should work fine now.
How do I do this in windows? :(
Install yarn, install electron-rebuild then maybe use "everything" from voidtools to search the executables and add them to PATH (if they are not)
Then search .vscode folder in c:\users\
again easier thing to use is "everything", just search .vscode and select the right one if you get multiple
I fixed the problem without switching to the vscode insiders build.
The extension has a couple of modules that have native bindings built for a different version of node/electron.
- Install electron-rebuild. I use yarn:
yarn global add electron-rebuild.cd $HOME/.vscode-oss/extensions/vsciot-vscode.vscode-arduino-0.3.2/out/node_modules/usb-detection(change the .vscode-oss path and the version of vscode-arduino accordingly to your environment)yarn add nan; electron-rebuild -v 9(9 is the version of electron used by your vscode)I configured node to install global packages in
$HOME/.npm-packageswith$HOME/.npm-packages/binin my PATH. You have to adapt the call toelectron-rebuildbased on your environment.
cd $HOME/.vscode-oss/extensions/vsciot-vscode.vscode-arduino-0.3.2/out/node_modules/@serialport/bindings; yarn add nan; electron-rebuild -v 9The serial port selection and monitor should work fine now.
How do I do this in windows? :(
Install yarn, install electron-rebuild then maybe use "everything" from voidtools to search the executables and add them to PATH (if they are not)
Then search .vscode folder in c:\usersdirectory and follow the same steps again easier thing to use is "everything", just search .vscode and select the right one if you get multiple
Thanks! I'll give it a try!
So from May 2019 until October 2020 the problem can't be fixed?
Time to move on to some other app??
Most helpful comment
The bug still exists here in my Windows:
Clicking "Select a Serial Port" does noting.