Getting "bash: XXX: command not found" in VS Code terminal - visual-studio-code

I am getting this error on my VS Code terminal. I have tried reinstalling the IDE but it did not go away. I am using Linux mint.

This VScode issue they say "By default the VS Code integrated terminal does not run as a login shell".
As this is n answer from 2016, the option they give is deprecated.
The problem I has is running the terminal in WSL environment and what worked for me is to add the following to my setting.json:
{
"terminal.integrated.profiles.linux": {
"bash": {
"path": "bash",
"icon": "terminal-bash",
"args": [
"--login"
]
}
}
}
You then need to delete the open terminal (the dustbin icon) and reopen. Or just restart VScode.

Related

In vs code terminal only cmd shows up in the drop down

In vs code terminal only cmd shows up in the drop down. I used to have PowerShell, Git Bash, etc. Any idea what happened and how I can fix it?
My VS Code version information is:
Version: 1.27.1 (user setup)
Commit: 5944e81f3c46a3938a82c701f96d7a59b074cfdc
Date: 2018-09-06T09:21:18.328Z
Electron: 2.0.7
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
Architecture: x64
I noticed that my C:\Users\YourLegalId\AppData\Roaming\Code\User\settings.json file looked like:
{
"editor.largeFileOptimizations": false,
"editor.renderControlCharacters": true,
"terminal.integrated.shell.windows": "C:\\windows\\System32\\cmd.exe"
}
I asked coworker what theirs looked like and he said his was empty. I tried emptying min out and then I only see PowerShell!
You can tweak the drop down menu by adding these lines to your settings.json and modify them as you see fit:
// The Windows profiles to present when creating a new terminal via the terminal dropdown.
// Use the `source` property to automatically detect the shell's location.
// Or set the `path` property manually with an optional `args`.
//
// Set an existing profile to `null` to hide the profile from the list,
//for example: `"Ubuntu-20.04 (WSL)": null`.
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell"
},
"Command Prompt": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"args": [],
"icon": "terminal-cmd"
},
"Git Bash": {
"source": "Git Bash"
}
},
Then, you can choose your default shell by adding this line:
"terminal.integrated.defaultProfile.windows": "PowerShell",
The version that I had 1.27.1 was quite old, even though Help > Check for Updates showed no updates available. I downloaded a new VS code from Microsoft's website and ran it. I was upgraded to version 1.63.2 and it fixed my command prompt issues.

Visual code debugger adapter immediately dies when trying to connect to vscode-hack debugger in local launch mode

I am using the vscode-hack extension on visual code studio on macOS Big Sur. My settings.json includes following launch configuration:
"configurations": [
{
"name": "HHVM: Run Script",
"type": "hhvm",
"request": "launch",
"script": "${file}",
"hhvmPath": "/usr/local/bin/hhvm",
"hhvmArgs": ["--mode", "vsdebug", "--vsDebugPort", 8999],
"cwd":"${workspaceFolder}"
}
]
When I try to debug a Hack script in Visual code debugger, Visual code debugger adapter launches and immediately dies. I have verified launching hhvm with the same args from command line, and it works fine. I am following the instructions here https://github.com/slackhq/vscode-hack/blob/master/docs/debugging.md
Does anybody have any suggestions?

arduino settings for Visual Studio Code

This is driving me crazy! I see solutions all over the web and I still can't get this to work. Here is my settings.json file:
{
"C_Cpp.updateChannel": "Insiders",
"workbench.editorAssociations": {
"*.ipynb": "jupyter.notebook.ipynb"
},
"arduino.additionalUrls": "",
"arduino.path": "C:\\Program Files (x86)\\Arduino",
"arduino.commandPath": "arduino.exe",
"files.autoSave": "onWindowChange",
}
I am running on Windows 10 and Arduino is installed in:
C:\Program Files (x86)\Arduino
I have four executables there:
arduino.exe
arduino_debug.exe (I downloaded this for good measure!)
arduino-cli.exe
uninstall.exe
When I click "Select Programmer" in VSC, I get"
"Cannot find Arduino IDE. Please specify the "arduino.path" in the User Settings. Requires a restart after change.
I have restarted the IDE and still get the same problem.
I have rebooted the laptop.
I have tried uninstalling both VSC and Arduino.
The Arduino IDE works fine stand-alone.
Wow! I finally stumbled on these installation instructions:
https://nortronics.com.au/setting-up-visual-studio-code-for-arduino-programming/
This is what my .vscode/settings.json (you can find it in the left pane under .vscode in your project folder) now looks like:
{
"arduino.path": "C:\\Program Files (x86)\\Arduino",
"C_Cpp.intelliSenseEngineFallback": "Disabled",
"C_Cpp.intelliSenseEngine": "Tag Parser",
"arduino.enableUSBDetection": true,
}

Visual Studio Code Debugger not launching

OS and Version: Windows 10 Build 19042.985
VS Code Version: 1.56.2
C/C++ Extension Version: v1.4.0-insiders
other extensions: remote-ssh
I've been working with remote-ssh on a raspberry and c/c++ extension without any issue, all of a sudden I cannot start the debugger. Nothing changed, configuration files are the same as before but now when I start the debugger, I see for a couple of seconds the top debugging bar and then it disappears. No message on the console, nothing.
For this purpose, I created a simple project from scratch, and even there, the same issue appears.
To Reproduce
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"logging": { "engineLogging": true },
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": false
}
]
}
]
}
main.c
#include <stdio.h>
int main(){
printf("ciao\n");
return 1;
}
Compile with gcc -g main.c
As I stated before, this workflow worked for me, from one second to another it stopped working as intended and I have no idea why and how to fix it, any help is appreciated.
What I tried
reinstall vscode
reinstall the c/c++ extension and delete by hand the extension folder
numerous reboots
Updates
I have tried with the wsl-remote extension and it is working as expected.รน
Tried to uninstall gdb from host and launch the debug session, the message "gdb" not found does not even appear as it should
I was in similar situation and couldn't find relevant resolutions:
Quick Answer:
After upgrade to VS Code 1.56.2, make sure to remove old breakpoints and create new breakpoint and at-least have 1 breakpoint and launch.json available.
Lengthy details:
I have similar issue for python scripts when I start the "debugger bar" I see it for a couple of seconds the top debugging bar and then it disappears. Bu then no message on the console, nothing. I tried reinstalling VS Code, enabling/disabling extension, various restart.
OS and Version: Mac OSX Version 11.4 (20F71)
VS Code Version: 1.56.2
Extension: Python v2021.5.842923320 by Microsoft
RootCause:
What I did know for sure that I updated my VS Code, and after that this mysterious issue start happening, so when to release log of VS Code 1.56.2. I found below release log
Debug view displayed on break#
The default value of the debug.openDebug setting is now
openOnDebugBreak so that on every breakpoint hit, VS Code will open
the Debug view. The Debug view is also displayed on first session
start.
So VS code Version 1.56 release, debugger will only show when at-least 1 breakpoint is found. However, looks like there is issue with their internal code checking for historical breakpoint data after VS Code upgrade..
https://code.visualstudio.com/updates/v1_56#_debug-view-displayed-on-break
I had this same issue in python. The fix for python was changing to a valid interpreter due to a python library not being installed. Make sure that the interpreter is correct and then try again.
This may be caused by a faulty installation of the VS Code C/C++ extension. When launching VS Code, if the message "Unable to start the C/C++ language server. IntelliSense features will be disabled" appears, this is probably the cause. Was able to fix the installation in this case by installing a previous version of the C/C++ extension as per this answer.
I had the same problem (though the debug bar would show up for a second and then disappear). I was using a conda env with python 3.6. I updated to 3.8, with the same dependencies, and it started working.

Using git-bash with visual studio code

I normally use git-bash.exe on Windows 10 but visual studio code seems to use bash.exe. bash.exe seems very limited :(
I am trying to either get bash.exe to be more useful or get git-bash.exe to run in the terminal at the bottom of the screen.
Any suggestions?
// this opens the terminal window at the bottom of code
// but as I said, seems limited.
{
"shell": "C:\\Program Files\\Git\\bin\\bash.exe",
"label": "Git bash"
}
// the problem with this is it opens a new window when
// run and I would prefer it be at the bottom.
{
"shell": "C:\\Program Files\\Git\\git-bash.exe",
"label": "Git bash"
},