microsoft / vscode-arduino

Visual Studio Code extension for Arduino
Other
1.17k stars 221 forks source link

Serial monitor not works after VSCode updated to 1.49.0 #1097

Closed hellyzh closed 3 years ago

hellyzh commented 4 years ago

Serial monitor not works after VSCode updated to 1.49.0 with Electron 9.2.1 . Error: _ Failed to open serial port COM3 due to error: + Error: The module '\\?\c:\Users\***\.vscode\extensions\vsciot-vscode.vscode-arduino-0.3.2\out\node_modules\usb-detection\build\Release\detection.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 75. This version of Node.js requires NODE_MODULE_VERSION 80. Please try re-compiling or re-installing the module (for instance, using `npm rebuild` or `npm install`). _

Enchan1207 commented 4 years ago

I face same issue too.
The port selection screen is not displayed even if I click <Select Serial Port>, so I can't operate serial monitor.
(The same applies when execute using command palette.)

Modify at 22:40 : It causes by node.js version...?
According to the first comment, the module usb-detection is build using NODE_MODULE_VERSION 75, so maybe it can be solved by compiling usb-detection on node.js 14.0.0 (NODE_MODULE_VERSION >= 80).

(Sorry for anbiguous comment, I'm not good at node.js and electron...)

rrakso commented 4 years ago

Yup! Me too! :<

jPerotto commented 4 years ago

UP, me too :/

vfranchi commented 4 years ago

I'm having the same issue, any workaround for this?

jPerotto commented 4 years ago

Yes, I downloaded version 1.48.2, and it worked again. https://code.visualstudio.com/updates/v1_48

I'm having the same issue, any workaround for this?

nikhillokeshc commented 4 years ago

Yes, I downloaded version 1.48.2, and it worked again. https://code.visualstudio.com/updates/v1_48

I'm having the same issue, any workaround for this?

I was having the same issue. The 1.48.2 version of vscode is worked for me too.

Josverl commented 4 years ago

Same problem, the underlying issue is that NodeJS makes it hard to interface with native hardware interfaces such as COMX: or /dev/usb123 for this node uses something called native bindings , which have a tendency to break at each and every update. until NodeJS has a better strategy for this , every extension developer will need to de the work to include updates for a number of future versions on NodeJS. I have solved this for the pymakr extension which used to have the same problem with serial ports

it would be nice if the VSCode platform included at least one serialport native binding that all extension makers could use to avoid everone needing to setup a CI/CD just to avoid this breaking.

thinkOfaNumber commented 4 years ago

See #922 for more history on this. The only solution is to go back to Code 1.48.2 until an updated extension version is released.

1-max-1 commented 4 years ago

Got the same issue

ETLin commented 4 years ago

i got same.

ETLin commented 4 years ago

Yes, I downloaded version 1.48.2, and it worked again. https://code.visualstudio.com/updates/v1_48

I'm having the same issue, any workaround for this?

worked for me too.

gelanchez commented 4 years ago

Same issue under GNU/Linux (Kubuntu 18.04) for VSCode 1.49.1

klanger59 commented 4 years ago

Same issue under Windows 10 for VSCode 1.49.1

PeterWone commented 4 years ago

Same problem, the underlying issue is that NodeJS makes it hard to interface with native hardware interfaces such as COMX: or /dev/usb123 for this node uses something called native bindings , which have a tendency to break at each and every update. until NodeJS has a better strategy for this , every extension developer will need to de the work to include updates for a number of future versions on NodeJS. I have solved this for the pymakr extension which used to have the same problem with serial ports

it would be nice if the VSCode platform included at least one serialport native binding that all extension makers could use to avoid everone needing to setup a CI/CD just to avoid this breaking.

@Josverl while I agree that the right place to fix this is in VSCode, how did you fix this? I'm looking at your repo https://github.com/Josverl/pymakr-vsc and I have two questions.

We can put your suggestion on the VS Code backlog by raising it as an issue and getting 20 people to vote for it, but an even faster way to get it done is to submit a PR. This is why I'm interested in how you did it.

Josverl commented 4 years ago

@PeterWone

the approach was to :

  1. download the native bindings for upcoming VSCode versions --> Electron Versions --> native Bindings
    • this required some creative manners to get that information
    • then additional creativity to download the native bindings
    • then even more to find that some of the pre-comibles offered were actually broken
    • figure out a way to store multipole versions / platforms of ntive bindings that can be located by the load-libraries used by serialport
  2. create test projects to run against electron version N on Platform X , with bitness Y , with the downloaded binaries
  3. run CI/CD [Nightly / on Commit / PR ] using GitHub actions that flags if upcoming versions ( ie Insiders ) will be broken
  4. [did not Implement] create a automated PR with new native bindings as they are released
  5. requires manual action on failed CI/CD Builds

something like the above would be needed for each Project Please refer to: https://github.com/pycom/pymakr-vsc/pull/59 ( i learned more than i wanted to know when figuring out a workaround for something that i assumed was a trivial fix ....)

but as you can see , also pymakr had the same issue as there was still a manual step to watch the CI/CD against for the insiders build. and even including Serialport in VSCode will not solve the problem , only shift it to a place where it can be managed, but actually it should not need to be managed/contained, it should be prevented.

I agree that N-API would be much better, and shift the responsibility to the creators of library , but the suggestion for that seems 3 year old with no followup that i could find.

HeAtNet commented 4 years ago

Same issue under Windows 10 for VSCode 1.49.2. Also cannot select other serial port. Uploading works fine.

PeterWone commented 4 years ago

Yes, I reached similar conclusions.

What I have done instead is create a whole new extension that integrates the new Arduino-CLI.

This is currently an incomplete prototype but progress is rapid. So far I have support for

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10

From: Jos Verlindemailto:notifications@github.com Sent: Monday, 28 September 2020 8:35 PM To: microsoft/vscode-arduinomailto:vscode-arduino@noreply.github.com Cc: Peter Wonemailto:peter.wone@outlook.com; Mentionmailto:mention@noreply.github.com Subject: Re: [microsoft/vscode-arduino] Serial monitor not works after VSCode updated to 1.49.0 (#1097)

@PeterWonehttps://github.com/PeterWone

the approach was to :

  1. download the native bindings for upcoming VSCode versions --> Electron Versions --> native Bindings

    • this required some creative manners to get that information
    • then additional creativity to download the native bindings
    • then even more to find that some of the pre-comibles offered were actually broken 2 - figure out a way to store multipole versions / platforms of ntive bindings that can be located by the load-libraries used by serialport 2 create test projects to run against electron version N on Platform X , with bitness Y , with the downloaded binaries 3 run CI/CD [Nightly / on Commit / PR ] using GitHub actions that flags if upcoming versions ( ie Insiders ) will be broken 4 [did not Implement] create a automated PR with new native bindings as they are released 5 requires manual action on failed CI/CD Builds

something like the above would be needed for each Project Please refer to: pycom/pymakr-vsc#59https://github.com/pycom/pymakr-vsc/pull/59 ( i learned more than i wanted to know when figuring out a workaround for something that i assumed was a trivial fix ....)

but as you can see , also pymakr had the same issue as there was still a manual step to watch the CI/CD against for the insiders build. and even including Serialport in VSCode will not solve the problem , only shift it to a place where it can be managed, but actually it should not need to be managed/contained, it should be prevented.

I agree that N-API would be much better, and shift the responsibility to the creators of library , but the suggestion for thathttps://github.com/serialport/node-serialport/issues/1186 seems 3 year old with no followup that i could find.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/vscode-arduino/issues/1097#issuecomment-699925572, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABJ6QOCCPB7Y2SRTQX3PDYLSIBRGHANCNFSM4RGJN2GQ.

gren236 commented 4 years ago

Same problem here. Looking forward to a fix!

kseyhan commented 4 years ago

check the solution proposed here https://github.com/microsoft/vscode-arduino/issues/1113#issuecomment-714255377 if have a proper build environment on your machine.

Josverl commented 4 years ago

I think the point is not that that (rebuilding the native module) can or cannot be done by some users, on some machines.

In my view a user should not need to compile from source to use a published vscode add-in . And specifically if that in fact means that all users on all platforms and all CPU architectures and all bitnesses will need to rebuild from source every time that the electron environment hits an upgrade bump..

that is similar to to getting a car (for free or paid) only to find that you need to rebuild the clutch every 5 months. the reasoning that the parts are is included , the tools are free to use and the manual is on the internet does not address the principle point.

The current serial implementation is using the old-tech NAN , the requires a rebuild after very bump in the road . the future stable solutions are :

so if you care , please ask the serialport maintainers to support one of these APIs , or if you have skills in C / C++ help pitch in the create or test that https://github.com/serialport/node-serialport/search?q=%22N-API%22&type=issues

kseyhan commented 4 years ago

@Josverl i'm not realy deep enough into the architecture of the vscode extensions but normaly it should be sufficient to simply distribute the platform dependend extensions from a central point like serialport is doing but i dont know if this is done with vscode extensions at all.

But to be true i'm neither going to run after the maintainers from this scary piece of software nor i want to be integrated into it at all. My way would be to find a complete different approach like maybe a better library to use ( unfortunaltely i'm not deep enough in nodejs that i would know a solution right now) or simply going @PeterWone 's approach by just integrating the arduino cli, shelling out all those problems and having a much better solution in the end or simply writing a complete new library for the serial drivers that get installed by default from the arduino ide. If the arduino ide manages to have a way to communicate with their drivers plattform independend from java it shouldnt be to hard to port that over to nodejs.

hasantezcan commented 4 years ago

I just update the engines section in package.json and I did not see no more errors

//in package.json
    "engines": {
        "vscode": "^1.5.0"
    },

update like that

    "engines": {
        "vscode": "^1.34.0"
    }, 
PeterWone commented 4 years ago

If the arduino ide manages to have a way to communicate with their drivers plattform independend from java it shouldnt be to hard to port that over to nodejs.

It has conditional compiles and platform specific code for calls into native code. Porting their method to Node will end up with exactly the same problems you are currently experiencing. That is why I chose the approach I am using.

robotdad commented 3 years ago

Prerelease build for the serial port issue is here: https://github.com/microsoft/vscode-arduino/releases/tag/v0.3.3-rc

I plan to publish a release with this fix tomorrow, Oct 30.

robotdad commented 3 years ago

Resolved in release 0.3.3

luanphamng commented 3 years ago

Upgraded to version 1.51.1. The Problem was fixed.

jalbarra commented 3 years ago

Hi, I have the same problem, when I want open the serial monitor this is the message, and I have the last vscode version,

"Failed to open serial port COM8 due to error: + Error: The module '\?\c:\Users\Jalbarra.vscode\extensions\vsciot-vscode.vscode-arduino-0.3.4\out\node_modules\usb-detection\build\Release\detection.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 80. This version of Node.js requires NODE_MODULE_VERSION 85. Please try re-compiling or re-installing the module (for instance, using npm rebuild or npm install)."

I have this versions, Version: 1.53.0 (user setup) Commit: 8490d3dde47c57ba65ec40dd192d014fd2113496 Date: 2021-02-03T20:36:38.611Z Electron: 11.2.1 Chrome: 87.0.4280.141 Node.js: 12.18.3 V8: 8.7.220.31-electron.0 OS: Windows_NT x64 10.0.19041

pawelkedra commented 3 years ago

Problem still occurs on 1.53.0 (Mac OS):

Failed to open serial port /dev/tty.usbmodem14101 due to error: + Error: The module '/Users/pabloz/.vscode/extensions/vsciot-vscode.vscode-arduino-0.3.4/out/node_modules/usb-detection/build/Release/detection.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 80. This version of Node.js requires NODE_MODULE_VERSION 85. Please try re-compiling or re-installing the module (for instance, using `npm rebuild` or `npm install`).

Version: 1.53.0 Commit: 8490d3dde47c57ba65ec40dd192d014fd2113496 Date: 2021-02-03T16:01:04.046Z Electron: 11.2.1 Chrome: 87.0.4280.141 Node.js: 12.18.3 V8: 8.7.220.31-electron.0 OS: Darwin x64 20.3.0

matburnham commented 3 years ago

Just had the same problem with 1.53.2 on Windows.

image

Version: 1.53.2 (user setup)
Commit: 622cb03f7e070a9670c94bae1a45d78d7181fbd4
Date: 2021-02-11T11:48:04.245Z
Electron: 11.2.1
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Windows_NT x64 10.0.19041

Fixed it by following https://github.com/microsoft/vscode-arduino/issues/1198#issuecomment-774746151

Benargee commented 3 years ago

Also having the same issue. I can upload if I manually set COM port in arduino.json but can not monitor it from within VSCode.

Failed to open serial port COM5 due to error: + Error: \\?\c:\Users\benrg\.vscode\extensions\vsciot-vscode.vscode-arduino-0.3.4\out\node_modules\usb-detection\build\Release\detection.node is not a valid Win32 application.
\\?\c:\Users\benrg\.vscode\extensions\vsciot-vscode.vscode-arduino-0.3.4\out\node_modules\usb-detection\build\Release\detection.node
Version: 1.53.2 (user setup)
Commit: 622cb03f7e070a9670c94bae1a45d78d7181fbd4
Date: 2021-02-11T11:48:04.245Z
Electron: 11.2.1
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Windows_NT x64 10.0.19042
cssinate commented 3 years ago

@Benargee - https://github.com/microsoft/vscode-arduino/issues/1198#issuecomment-774746151 works

HowardHonig commented 3 years ago

Same problem as others in this thread on opening the serial monitor. I succumbed to a forced upgrade. I am getting so sick of all these frigin bugs in the Arduino extension.