joedevivo / vscode-circuitpython

VSCode extension for Adafruit's CircuitPython
MIT License
119 stars 34 forks source link

command 'circuitpython.openSerialMonitor' not found #46

Open Wintaru opened 3 years ago

Wintaru commented 3 years ago

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 commented 3 years ago

image

This happens in Windows 10 as well.

elexx commented 3 years ago

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.

wildestpixel commented 3 years ago

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 commented 3 years ago

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
kwalkerk commented 3 years ago

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)

ysoldak commented 3 years ago

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

My setup

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)
a-27m commented 3 years ago

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

cshields commented 3 years ago

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"
    ]
GregWoods commented 3 years ago

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

dannystaple commented 3 years ago

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 commented 3 years ago

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.

ejangi commented 3 years ago

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.

dannystaple commented 3 years ago

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.

fivesixzero commented 3 years ago

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 commented 3 years ago

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

Wintaru commented 3 years ago

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.

fivesixzero commented 2 years ago

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.

cverbiest commented 2 years ago

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

Methodician commented 2 years ago

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.

JohnHind commented 2 years ago

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.

HughGrant commented 2 years ago

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

omerk commented 2 years ago

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

solarkraft commented 2 years ago

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

devoh747 commented 2 years ago

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.

seanmrice commented 2 years ago

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.

ericmharris commented 1 year ago

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 commented 1 year ago

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

bgoosman commented 1 year ago

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

StephenFerrero commented 1 year ago

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.

nfoert commented 1 year ago

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.

Patrick8195 commented 9 months ago

Found a solution to this problem on my Macbook Pro M2 on Sonama 14.2.1 with VS Code and extension installed.

I needed to let the VS Code application have full access to the disk drive, then uninstalled and reinstalled the extension. Works fine now.

Look under the System Settings --> Privacy and Security --> Full Disk Access and turn it on for VS Code.

There probably is a way to restrict what directories VS Code needs, but I found this to work for me.

Hope this helps...

nicelifeBS commented 8 months ago

The Open Folder solution doesn't work for me on Win10 with version 0.2.0 still get the error that the console cannot open.

sua-dev commented 8 months ago

Found a solution to this problem on my Macbook Pro M2 on Sonama 14.2.1 with VS Code and extension installed.

I needed to let the VS Code application have full access to the disk drive, then uninstalled and reinstalled the extension. Works fine now.

Look under the System Settings --> Privacy and Security --> Full Disk Access and turn it on for VS Code.

There probably is a way to restrict what directories VS Code needs, but I found this to work for me.

Hope this helps...

Followed this and has worked on my m1 mac. It was a bit fiddly a few times but after uninstalling it, restarting vs code and reinstalling it again, it worked!

mnai01 commented 8 months ago

On Win 10, downgrading extension to v0.2.0 worked for me

nrgbistro commented 8 months ago

I'm using v0.2.0 of this extension on windows 11 and cannot run any of the circuitpython commands.

rossiniscarface commented 8 months ago

Installed latest version of Visual Studio Code on Windows 11; Freshly installed CircuitPython extension v0.2.0 and none of the commands work, or the drive is recognized. Tried to install v0.1.20 and it works?

frkwssmth commented 7 months ago

On windows 11, downgrading the extension to v0.1.20 also worked for me! Finally...

sveinungkb commented 7 months ago

Rolling back worked here too. Ubuntu 22.

KineticPrecision commented 7 months ago

Downgrading CircuitPython extension to 0.1.20 also worked here. Win 10.

johnwyles commented 7 months ago

For those wondering use these instructions to bump down to 0.1.20 (which is all that fixed this for me): https://bobbyhadz.com/blog/install-older-version-of-extension-in-vscode

sidprice commented 7 months ago

Rolling back to 0.1.20 worked on Windows too.

SergiuToporjinschi commented 5 months ago

This problem is still reproducible .... for me at least... Current instalation: Windows 11 (fresh install) vsCode (portable latest version) extensions installed image I tried everything above, nothing worked, for all circuitPython extension all commands are not found.....

I can see that first occurence is 3 years old so fair question ... is this extension still maintained ???

JohnHind commented 5 months ago

This problem is still reproducible .... for me at least...

It is worth noting that there is now an official Microsoft maintained COM (and TCP) port terminal for VS Code: `Serial Monitor'. Still marked 'Preview', but seems to work OK for me on Windows and there is a better chance that library dependencies will be properly maintained on all platforms. I do not think the functionality of the CircuitPython Plugin beyond its serial terminal implementation justify its existence any more, but there is an API for Serial Monitor, so it could be modified to use this thus transferring the responsibility for maintaining dependencies to Microsoft.

SuarezLuis commented 4 months ago

Mac M1 Ultra, rolling back to 1.20 worked for me

epiqu1n commented 4 months ago

I am also experiencing this issue. I was really hoping this would work as I do not like Mu... guess I'll go back to Thonny

JohnHind commented 4 months ago

I am also experiencing this issue. I was really hoping this would work as I do not like Mu... guess I'll go back to Thonny

That is a bit drastic! I use the Microsoft 'Serial Monitor' plugin in conjunction with the native ability to open the code directly on the device with the MSD implementation in CircuitPython. The only other thing the CircuitPython plugin did was a little light library management which is pretty easy to do manually, or directly from GitHub using the built in integration.

epiqu1n commented 4 months ago

Oh! Thank you that works great; I was a bit tired that night so a bit too defeatist I guess 😅

johnwyles commented 4 months ago

Oh! Thank you that works great; I was a bit tired that night so a bit too defeatist I guess 😅

I hear ya. With kubernetes or homeassistant it’s usually 🙂 -> 😕 -> 🥴 -> 🙃 … 🤣

Patcybermind commented 3 months ago

same problem here 1.20 works but none other versions seem to work

CombatVolcano commented 3 months ago

same problem what gives this is pretty basic and important