vscode-circuitpython icon indicating copy to clipboard operation
vscode-circuitpython copied to clipboard

command 'circuitpython.openSerialMonitor' not found

Open Wintaru opened this issue 3 years ago • 50 comments

Command 'CircuitPython: Open Serial Monitor' resulted in an error (command 'circuitpython.openSerialMonitor' not found)

I tried with the build indicated here:

https://github.com/joedevivo/vscode-circuitpython/issues/38#issuecomment-814239981

with no luck. I get the above text on my M1 Mac running Big Sur.

Wintaru avatar Apr 12 '21 19:04 Wintaru

image

This happens in Windows 10 as well.

Wintaru avatar Apr 12 '21 19:04 Wintaru

I can reproduce this on Linux (Manjaro 21.0.1, Kernel 5.10.26-1). Downgrading the Extension to 0.1.8 resolves this problem for me.

elexx avatar Apr 12 '21 19:04 elexx

This has now started to occur for myself - I cannot use the extension - only thing it now does is update the bundle and cannot do anything else. VSCode Universal binary 1.55.2 on M1 Big Sur 11.3. Seems to coincide with 11.3 update for me but only be coincidence - may be updates to MS python package or something else.

wildestpixel avatar May 01 '21 06:05 wildestpixel

Same error trying to show available libraries :

[2021-05-01 17:05:35.465] [exthost] [error] TypeError: Cannot read property 'name' of undefined
	at new LibraryQP (/Users/pixel/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.11/out/librarymanager/libraryManager.js:41:24)
	at /Users/pixel/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.11/out/librarymanager/libraryManager.js:174:26
	at Array.forEach (<anonymous>)
	at LibraryManager.getInstalledChoices (/Users/pixel/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.11/out/librarymanager/libraryManager.js:171:59)
	at LibraryManager.getAllChoices (/Users/pixel/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.11/out/librarymanager/libraryManager.js:165:37)
	at LibraryManager.<anonymous> (/Users/pixel/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.11/out/librarymanager/libraryManager.js:140:32)
	at Generator.next (<anonymous>)
	at /Users/pixel/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.11/out/librarymanager/libraryManager.js:8:71
	at new Promise (<anonymous>)
	at __awaiter (/Users/pixel/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.11/out/librarymanager/libraryManager.js:4:12)
	at LibraryManager.show (/Users/pixel/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.11/out/librarymanager/libraryManager.js:139:16)
	at /Users/pixel/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.11/out/container.js:51:77
	at S._executeContributedCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:86:106770)
	at S.$executeContributedCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:86:107208)
	at u._doInvokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:90:12794)
	at u._invokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:90:12478)
	at u._receiveRequest (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:90:11145)
	at u._receiveOneMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:90:9931)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:90:8032
	at _.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57:1836)
	at E.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:15496)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:105:29750
	at _.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57:1836)
	at E.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:15496)
	at t._receiveMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:20754)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:17640
	at _.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:57:1836)
	at acceptChunk (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:12861)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:65:12209
	at Socket.w (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:105:13173)
	at Socket.emit (events.js:315:20)
	at addChunk (_stream_readable.js:295:12)
	at readableAddChunk (_stream_readable.js:271:9)
	at Socket.Readable.push (_stream_readable.js:212:10)
	at Pipe.onStreamRead (internal/stream_base_commons.js:186:23) circuitpython.library.show

wildestpixel avatar May 01 '21 16:05 wildestpixel

Having the same problem on Ubuntu 20.04. None of the circuitpython commands work. Here is example error: Command 'CircuitPython: Open Serial Monitor' resulted in an error (command 'circuitpython.openSerialMonitor' not found)

kwalkerk avatar May 01 '21 20:05 kwalkerk

Does not work for me either, none of commands can be found.

My setup

  • macOS Big Sur 11.3.1
  • VSCode 1.55.2
  • CircuitPython plugin 0.11.1
  • Python plugin v2021.4.765268190
  • Pylance plugin v2021.4.3

Hope this helps:

[2021-05-04 18:38:09.466] [exthost] [error] Activating extension joedevivo.vscode-circuitpython failed due to an error:
[2021-05-04 18:38:09.466] [exthost] [error] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null
	at validateString (internal/validators.js:120:11)
	at Object.resolve (path.js:980:7)
	at ProviderAsync._getRootDirectory (/Users/yursol/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.11/node_modules/fast-glob/out/providers/provider.js:17:21)
	at ProviderAsync.read (/Users/yursol/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.11/node_modules/fast-glob/out/providers/async.js:11:27)
	at Array.map (<anonymous>)
	at getWorks (/Users/yursol/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.11/node_modules/fast-glob/out/index.js:58:18)
	at FastGlob (/Users/yursol/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.11/node_modules/fast-glob/out/index.js:10:19)
	at /Users/yursol/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.11/node_modules/globby/index.js:133:52
	at Array.map (<anonymous>)
	at module.exports (/Users/yursol/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.11/node_modules/globby/index.js:133:40)

ysoldak avatar May 04 '21 16:05 ysoldak

Disabling extension JavaScript Debugger (ms-vscode.js-debug-nightly) solved the problem for me,

macOS Big Sur 11.3 (Intel) VSCode 1.55.2 CircuitPython 0.1.11

a-27m avatar May 04 '21 17:05 a-27m

this may or may not help, but out of the box I get a null entry in place of what should be the boards path in the settings.json

    "python.analysis.extraPaths": [
        null,
        "c:\\Users\\user\\.vscode\\extensions\\joedevivo.vscode-circuitpython-0.1.11\\stubs",
        "c:\\Users\\user\\AppData\\Roaming\\Code\\User\\globalStorage\\joedevivo.vscode-circuitpython\\bundle\\20210507\\adafruit-circuitpython-bundle-py-20210507\\lib"
    ]

cshields avatar May 08 '21 14:05 cshields

Getting the same issue on Windows The only extensions enabled are...

CircuitPython 0.1.13 Jupyter 2021.6.811652604 PyLance 2021.5.1 Python 2021.4.765268190

I tried running as administrator as well. No joy. All the CircuitPython extension commands fail.

Update: I just found the Log

[2021-05-09` 21:01:23.903] [exthost] [error] Activating extension joedevivo.vscode-circuitpython failed due to an error:
[2021-05-09 21:01:23.903] [exthost] [error] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null

And VS Code Info...

Version: 1.56.0 (system setup) Commit: cfa2e218100323074ac1948c885448fdf4de2a7f Date: 2021-05-04T22:09:06.405Z Electron: 12.0.4 Chrome: 89.0.4389.114 Node.js: 14.16.0 V8: 8.9.255.24-electron.0 OS: Windows_NT x64 10.0.19042

GregWoods avatar May 09 '21 20:05 GregWoods

Reproduced on MacOS Big Sur, VSCode 1.56.1. Fresh install CircuitPython 0.1.13. The extension Host log has an error similar to @GregWoods. I've added the full traceback here:

[2021-05-16 13:18:59.121] [exthost] [error] Activating extension joedevivo.vscode-circuitpython failed due to an error:
[2021-05-16 13:18:59.121] [exthost] [error] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null
	at validateString (internal/validators.js:124:11)
	at Object.resolve (path.js:980:7)
	at ProviderAsync._getRootDirectory (/Users/danielstaple/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.13/node_modules/fast-glob/out/providers/provider.js:17:21)
	at ProviderAsync.read (/Users/danielstaple/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.13/node_modules/fast-glob/out/providers/async.js:11:27)
	at Array.map (<anonymous>)
	at getWorks (/Users/danielstaple/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.13/node_modules/fast-glob/out/index.js:58:18)
	at FastGlob (/Users/danielstaple/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.13/node_modules/fast-glob/out/index.js:10:19)
	at /Users/danielstaple/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.13/node_modules/globby/index.js:133:52
	at Array.map (<anonymous>)
	at module.exports (/Users/danielstaple/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.13/node_modules/globby/index.js:133:40)

This feels like some extension path configuration setting here. @cshields may be on to something. I also found the null:

    "python.analysis.extraPaths": [
        null,
        "/Users/danielstaple/.vscode/extensions/joedevivo.vscode-circuitpython-0.1.13/stubs",
        "/Users/danielstaple/Library/Application Support/Code/User/globalStorage/joedevivo.vscode-circuitpython/bundle/20210514/adafruit-circuitpython-bundle-py-20210514/lib"
    ]

Going to try remove it and see what happens.

dannystaple avatar May 16 '21 12:05 dannystaple

If I remove the null, and restart vscode, I see the same error, and the null has sprung back. Going to try the boards path (as @cshields hinted at above) - "/Volumes/CIRCUITPY/" - not sure that is what was meant, but it's worth a shot.

dannystaple avatar May 16 '21 12:05 dannystaple

I was getting this error, but it turns out that the board only had the UF2 bootloader on it and I needed to install circuit python. Once I did that, the errors went away.

ejangi avatar Jun 09 '21 10:06 ejangi

Unfortunately - I'm not finding that. I have CircuitPython on there, I'm able to see the CIRCUITPY volume, copy code there. The command screen /dev/tty.usbmodem144101 gives me the repl so I am able to get serial comms with the board. VScode still shows the same error.

dannystaple avatar Jun 15 '21 20:06 dannystaple

Ran into this problem today on a Windows system. Which is weird because on another Windows laptop the serial monitor has been working fine.

The rest of the extension seems to work fine - library management, board info, etc. No errors or odd behavior.

On trying to start the serial monitor, I get the following error.

Command 'CircuitPython: Open Serial Monitor' resulted in an error (command 'circuitpython.openSerialMonitor' not found)

Tried the 'Close Serial Monitor' command and got a similar message:

Command 'CircuitPython: Close Serial Monitor' resulted in an error (command 'circuitpython.closeSerialMonitor' not found)

And, for good measure, I tried 'Select Serial Port', which also resulted in a similar error:

Command 'CircuitPython Select Serial Port' resulted in an error (command 'circuitpython.openSerialMonitor' not found)

None of the logs in the Outputs panel reported any errors during VS Code startup, extension install, or when the commands were run.

However, there was interseting stuff in the console output that might be helpful:

console.ts:137 [Extension Host] Error: Could not locate the bindings file. Tried:
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\build\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\build\Debug\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\build\Release\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\out\Debug\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\Debug\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\out\Release\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\Release\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\build\default\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\compiled\14.16.0\win32\x64\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\addon-build\release\install-root\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\addon-build\debug\install-root\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\addon-build\default\install-root\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\lib\binding\node-v89-win32-x64\bindings.node
	at bindings (c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\bindings\bindings.js:126:9)
	at Object.<anonymous> (c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\lib\win32.js:1:98)
	at Module.u._compile (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:1315)
	at Object.Module._extensions..js (internal/modules/cjs/loader.js:1155:10)
	at Module.load (internal/modules/cjs/loader.js:982:32)
	at Module._load (internal/modules/cjs/loader.js:823:14)
	at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
	at Function.n._load (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:104:28060)
	at Function.P._load (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:104:24648)
	at Function.l._load (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:94:59608)
	at Module.require (internal/modules/cjs/loader.js:1006:19)
	at Module.require (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\microsoft-authentication\dist\extension.js:1:38760)
	at v (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:698)
	at Object.<anonymous> (c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\lib\index.js:6:22)
	at Module.u._compile (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:1315)
	at Object.Module._extensions..js (internal/modules/cjs/loader.js:1155:10)
	at Module.load (internal/modules/cjs/loader.js:982:32)
	at Module._load (internal/modules/cjs/loader.js:823:14)
	at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
	at Function.n._load (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:104:28060)
	at Function.P._load (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:104:24648)
	at Function.l._load (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:94:59608)
	at Module.require (internal/modules/cjs/loader.js:1006:19)
	at Module.require (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\microsoft-authentication\dist\extension.js:1:38760)
	at v (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:698)
	at new SerialMonitor (c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\out\serialmonitor\serialMonitor.js:43:34)
	at new Container (c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\out\container.js:29:31)
	at Function.<anonymous> (c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\out\container.js:38:39)
	at Generator.next (<anonymous>)
	at c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\out\container.js:8:71
	at new Promise (<anonymous>)
	at __awaiter (c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\out\container.js:4:12)
	at Function.newInstance (c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\out\container.js:36:16)
	at c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\out\extension.js:22:53
	at Generator.next (<anonymous>)
	at c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\out\extension.js:8:71
	at new Promise (<anonymous>)
	at __awaiter (c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\out\extension.js:4:12)
	at activate (c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\out\extension.js:16:12)
	at Function._callActivateOptional (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:90:14919)
	at Function._callActivate (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:90:14592)
	at c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:90:12789
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
	at async Promise.all (index 0)
	at async v.$activate (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:90:20144)
log.ts:295  WARN UNRESPONSIVE extension host, 'vscode.microsoft-authentication' took 74% of 619.069ms, saved PROFILE here: 'file:///c%3A/Users/me/AppData/Local/Temp/exthost-704879.cpuprofile' (8) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
console.ts:137 [Extension Host] c:\Users\me\AppData\Roaming\Code\User\globalStorage\joedevivo.vscode-circuitpython\bundle\20210805\adafruit-circuitpython-bundle-py-20210805\lib
console.ts:137 [Extension Host] e:\lib
console.ts:137 [Extension Host] e:\lib
console.ts:137 [Extension Host] Error: Could not locate the bindings file. Tried:
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\build\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\build\Debug\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\build\Release\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\out\Debug\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\Debug\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\out\Release\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\Release\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\build\default\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\compiled\14.16.0\win32\x64\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\addon-build\release\install-root\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\addon-build\debug\install-root\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\addon-build\default\install-root\bindings.node
 → c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\lib\binding\node-v89-win32-x64\bindings.node
	at bindings (c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\bindings\bindings.js:126:9)
	at Object.<anonymous> (c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\lib\win32.js:1:98)
	at Module.u._compile (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:1315)
	at Object.Module._extensions..js (internal/modules/cjs/loader.js:1155:10)
	at Module.load (internal/modules/cjs/loader.js:982:32)
	at Module._load (internal/modules/cjs/loader.js:823:14)
	at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
	at Function.n._load (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:104:28060)
	at Function.P._load (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:104:24648)
	at Function.l._load (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:94:59608)
	at Module.require (internal/modules/cjs/loader.js:1006:19)
	at Module.require (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\microsoft-authentication\dist\extension.js:1:38760)
	at v (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:698)
	at Object.<anonymous> (c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\node_modules\@serialport\bindings\lib\index.js:6:22)
	at Module.u._compile (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:1315)
	at Object.Module._extensions..js (internal/modules/cjs/loader.js:1155:10)
	at Module.load (internal/modules/cjs/loader.js:982:32)
	at Module._load (internal/modules/cjs/loader.js:823:14)
	at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
	at Function.n._load (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:104:28060)
	at Function.P._load (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:104:24648)
	at Function.l._load (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:94:59608)
	at Module.require (internal/modules/cjs/loader.js:1006:19)
	at Module.require (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\microsoft-authentication\dist\extension.js:1:38760)
	at v (c:\Users\me\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:698)
	at Container.<anonymous> (c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\out\container.js:59:17)
	at Generator.next (<anonymous>)
	at fulfilled (c:\Users\me\.vscode\extensions\joedevivo.vscode-circuitpython-0.1.14\out\container.js:5:58)
	at runMicrotasks (<anonymous>)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)

At first glance this seems to narrow things down to a problem loading the serialport node module. Unfortunately it looks like VSCode's extension host is eating the exception details though. :(

fivesixzero avatar Aug 05 '21 20:08 fivesixzero

I ended up having some more time to dig today, and I think I found a fix, or at least something to pinpoint the issue. 🎉

TL;DR: It looks like the serialport library that gets installed by default is compliled against a different version of the node ABI that VSCode's current version of Electron uses. So the library doesn't load, causing the enture serial module of the extension to fail to load.

My local fix required a bit of tinkering but I boiled it down to a few commands. It also spurred me to learn a bit about Node's package management, ABI versions, and Electron's bundled node versions, which was fun since my experience with those aspects of nodejs/electron is (so far) a bit limited.

Here are the commands I ran after installing the latest version of NodeJS:

rm /node_modules/serialport
rm /node_modules/@serialport

npm install electron-rebuild --save-dev
npm instal node-abi
npm install serialport

./node_modules/.bin/electron_rebuild --version 13.1.7

After this was done I was able to launch VSCode and use the three serial-related commands without any problems. The developer tools console was clear errors as well. :)

I'm not familiar enough (yet) with Node/Electron ABI selection and how they relate to VSCode packages to offer up a PR so hopefully this info will help find a fix.

edit: Got the idea to try this approach from this issue in the serialport repo: https://github.com/serialport/node-serialport/issues/1891

fivesixzero avatar Aug 05 '21 20:08 fivesixzero

I ended up having some more time to dig today, and I think I found a fix, or at least something to pinpoint the issue. tada

TL;DR: It looks like the serialport library that gets installed by default is compliled against a different version of the node ABI that VSCode's current version of Electron uses. So the library doesn't load, causing the enture serial module of the extension to fail to load.

My local fix required a bit of tinkering but I boiled it down to a few commands. It also spurred me to learn a bit about Node's package management, ABI versions, and Electron's bundled node versions, which was fun since my experience with those aspects of nodejs/electron is (so far) a bit limited.

Here are the commands I ran after installing the latest version of NodeJS:

rm /node_modules/serialport
rm /node_modules/@serialport

npm install electron-rebuild --save-dev
npm instal node-abi
npm install serialport

./node_modules/.bin/electron_rebuild --version 13.1.7

After this was done I was able to launch VSCode and use the three serial-related commands without any problems. The developer tools console was clear errors as well. :)

I'm not familiar enough (yet) with Node/Electron ABI selection and how they relate to VSCode packages to offer up a PR so hopefully this info will help find a fix.

edit: Got the idea to try this approach from this issue in the serialport repo: serialport/node-serialport#1891

I must be missing something because I tried to run electron-rebuild and it can't find the version indicated.

Wintaru avatar Sep 29 '21 16:09 Wintaru

I must be missing something because I tried to run electron-rebuild and it can't find the version indicated.

Sorry my quick hack didn't work out. :(

The Node ABI version used by VSCode or the version used to complie the serialport lib may have changed since I originally wrote that reply. Additionally, I recall having some weird issues with getting the right node-abi (edit: or electron_rebuild?) version(s) installed/availble that, in retrospect, I wish past me had left notes about. 🙄 Could be some memory-wires crossed there though. So some more research and testing will be required to find a proper workaround and/or fix.

If I have time this weekend to take a closer look myself I'll dig in and update this reply.

edit follows

TL;DR: No errors on two old, up-to-date VS Code installs with a freshly installed CircuitPython extension. And no errors on a fresh VS Code/extension install on a freshly set up Windows system. Maybe try using 13.5.1 with electron_rebuild?

I have a few Windows systems on my desk at the moment for reasons I can't fathom so I spent some time trying to reproduce this issue. My main desktop, where I applied the hacky fix in my prior post, is still working fine.

Both systems I tested the extension on are running VS Code 1.61.2 (which uses Electron 13.5.1 and Node.js 14.16.0) and I installed version 0.1.15 of this library using the extensions menu. VS Code was installed via the downloaded "user installer", not the Microsoft Store page. They're both old installs that have been updated many times over the last two years or so.

Selecting and opening a serial port worked as expected with no errors.

In the interest of being thorough I used a fresh install of Windows 10 to do some testing. On this system I started with installation of Python 3.10 and a fresh VS Code 1.61.2 install from the downloaded "user installer" package. After that I installed the Python and CircuitPython extensions installed via the Extensions tab.

Selecting and opening a serial port worked as expected with no errors.

But I know there at least was an issue before, between my own experiences and several other reports on this issue. Assuming things weren't fixed by a VS Code or dependency update somewhere then there's probably some local variable at play that's causing trouble.

If someone out there is still running into this issue I hope my notes prove helpful in finding a fix or a workaround.

One item to mention is that its quite possible that the hack above might work just by pointing electron_rebuild to the version of Electron that's currently used by VS Code. This does change regularly as they tend to update that somewhat quickly when a new 13.x version is released. It can be found easily in the VS Code Help -> About pane. Electron version 13.5.1 is only about a month old as of this posting and the 13.1.7 version I targeted with electron_rebuild in my prior post was also about 3-4 weeks old at the time.

fivesixzero avatar Oct 30 '21 23:10 fivesixzero

FWIW I had the same issue on Windows 10 while an update of Vscode was applied but VsCode was not yet restarted. I'm my case restart VsCode was enough to fix the issue

cverbiest avatar Dec 23 '21 08:12 cverbiest

I had this exact issue, possibly for different reasons, and nearly gave up, but I now have two potential fixes.

Solution 1: Initially, I had simply opened the file "code.py" in VSCode, without a workspace or folder. After finding Solution 2 below, I incidentally opened the entire drive on my microcontroller (in my case, "D:") as a folder. VSCode recognized the folder as a workspace, added some config, (.vscode/settings.json) and now the in-built serial monitor works.

Worth noting: unlike @cshields my python.analysis.extraPaths appears complete, with three auto-generated paths in an array. Although, following this thread it wasn't clear to me whether this config is related to the issue.

Solution 2: Not exactly a solution to this problem, but a potential work-around that worked for me: https://learn.adafruit.com/welcome-to-circuitpython/advanced-serial-console-on-windows is also just a nice tutorial on installing and utilizing PuTTY, and happens to work for this use case.

I'm using the VSCode extension CircuitPython v0.1.15 in case you are wondering.

Methodician avatar Jan 10 '22 19:01 Methodician

I originally saw this bug under Windows 10 and stopped using the extension because of it. I have since done a fresh OS install using Windows 11. Initially the extension worked fine, but the bug came back after I had installed some other extensions. I discovered a good work-around is simply to uninstall and re-install the extension. It seems to recur after I have been messing about with other extensions, but this may just be a coincidence.

Methodician's Solution 1 does not work for me because I have always been opening the CIRCUITPY drive as a folder and I still see the bug. Solution 2 rather defeats the point of the extension since it just uses VSCode as an editor, and the extension is not adding much. I found it easier just to use the Mu editor cutting and pasting code between it and VSCode for longer editing sessions.

JohnHind avatar Jan 27 '22 12:01 JohnHind

I'm on win11, all I do is uninstall and reinstall this plugin, and it worked.

HughGrant avatar Mar 07 '22 07:03 HughGrant

Windows 11, latest VS Code release. Uninstal and reinstall working here too. Did not work the first time around.

omerk avatar Mar 14 '22 15:03 omerk

That's not working for me with v0.1.19 installed on VSCodium 1.70.0 from Open VSX.

solarkraft avatar Sep 21 '22 19:09 solarkraft

Just had the same error. I was able to clear it with opening up the directory on the board (that is running circuitpython) and then selecting the file(code.py). It puts a .vscode directory on the board with a settings.json file in it. Uninstall/reinstall didn't work for me but the open directory did.

devoh747 avatar Sep 21 '22 21:09 devoh747

Just had the same error. I was able to clear it with opening up the directory on the board (that is running circuitpython) and then selecting the file(code.py). It puts a .vscode directory on the board with a settings.json file in it. Uninstall/reinstall didn't work for me but the open directory did.

Can confirm same resolution here. Opened the directory instead of the code.py file and issue resolved.

seanmrice avatar Oct 11 '22 01:10 seanmrice

Ctrl+Shift+p (on Windows) Workspaces: Add Folder to Workspace... Add the directory/drive containing your devices project files (eg. boot_out.txt, code.py) See ...\extensions\joedevivo.vscode-circuitpython-0.1.19-win32-x64\out\librarymanager\libraryManager.js:getProjectRoot() for better understanding of problem.

ericmharris avatar Nov 26 '22 16:11 ericmharris

And really nice work on the extension ... thanks much!

ericmharris avatar Nov 26 '22 16:11 ericmharris

I ran into this today and narrowed it down to disabling Pylance extension 🤦🏻.

bgoosman avatar Jan 03 '23 17:01 bgoosman

Just had the same error. I was able to clear it with opening up the directory on the board (that is running circuitpython) and then selecting the file(code.py). It puts a .vscode directory on the board with a settings.json file in it. Uninstall/reinstall didn't work for me but the open directory did.

Using 'Open Folder' and selecting the CircuitPython drive worked to fix this for me on Win 10.

StephenFerrero avatar Jan 21 '23 22:01 StephenFerrero

Using 'Open Folder' and selecting the CircuitPython drive worked to fix this for me on Win 10.

Worked for me as well on Windows 11.

nfoert avatar Jul 11 '23 13:07 nfoert