I cannot find the command to install shell commands to the path on the Command Palette in VS code for Ubuntu.Is it possible that something went wrong during the installation, or is there a solution that I am missing?
When I type in "Shell", my options are "Terminal: Allow Workspace Shell Configuration" and "Python: Run Selection/Line in Django Shell". There is nothing listed to Install a Shell command.
With latest version of vscode you should be able to ctrl + shift + p or cmd + shift + p (or whatever the hotkey is on ubuntu) and search for shell and then get what you see in the image.
It is said on the Vscode documentation: "Note: Users on macOS must first run a command (Shell Command: Install 'code' command in PATH)", so maybe the command is only available when running vscode from mac, and not ubuntu (and windows for that matter)? I don't know
Related
How can I run Gitk on WSL 2?
I already installed Gitk in WSL 2.
After I installed Gitk, I tried to run it but it failed with below error log:
application-specific initialization failed: no display name and no $DISPLAY environment variable
Error in startup script: no display name and no $DISPLAY environment variable
while executing
"load /usr/lib/x86_64-linux-gnu/libtk8.6.so Tk"
("package ifneeded Tk 8.6.8" script)
invoked from within
"package require Tk"
(file "/usr/bin/gitk" line 10)
Could you help me how can run Gitk on WSL 2?
You can install and run gitk straight from ubuntu terminal on Windows 11, using apt install.
I've just followed the steps from the following post and it worked:
https://learn.microsoft.com/en-us/windows/wsl/tutorials/gui-apps
I had to update not only the graphic driver but also the WSL.
Now, I can use either gitk or any linux app on Windows 11.
If git is installed on windows, you can find the gitk.exe by typing the following command to windows cmd:
where gitk
you can reach this folder from your wsl by changing the path e.g. from
C:\Git\cmd\gitk.exe
to
/mnt/c/Git/cmd/gitk.exe
and by typing this path to the terminal of your linux distribution, gitk can be opened.
UPDATE:
If you want to open gitk by typing it, you can add the path to ~/.bashrc with the following command (needed only once):
echo 'alias gitk="/mnt/c/Git/cmd/gitk.exe"' >> ~/.bashrc
And after that you can open gitk like:
gitk
This question already has answers here:
How can I run a Windows executable from WSL (Ubuntu) Bash
(6 answers)
Closed 5 months ago.
I install docker on my windows 10. after that I get a message that I need to download and install wsl2.
Now, when I run bash command I get wsl bash.
When I try to run node I get an error (node.exe is installed in my windows10):
DESKTOP-BVRDS:/tmp/docker-desktop-root/mnt/host/c/Users/myuser# node
bash: node: command not found
when I run echo $PATH I get output of:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
and not the windows path's. (where the node and other software installed).
How to solve this error? maybe change the default bash? to git bash? (which I don't know how)
In Cmder, open settings: Win + Alt + P
Under Startup > Tasks, add a task called {bash} with the following settings:
Task parameters (set icon):
For Cmder icon: /icon "%CMDER_ROOT%\cmder.exe"
For Git icon: /icon "C:\Program Files (x86)\Git\etc\git.ico"
Commands (open Git's bash shell):
"C:\Program Files (x86)\Git\bin\sh.exe" -l -new_console:d:%USERPROFILE%
Under Startup, set startup options to Specified name task --> {bash}
Please check below a couple of articles and should solve an issue.
https://gist.github.com/nickautomatic/02ccb76292f7f8d9767e
https://gingter.org/2016/11/16/running-windows-10-ubuntu-bash-in-cmder/
Please try below:
Open a regular command prompt (win+r then cmd)
Right-click the title bar and select Properties
Deselect "Use legacy console (requires restart)"
Now it should work either by launching the standalone app, or typing bash into a regular cmd window after restarting Command Prompt.
I got Ocaml for Windows which comes prepackaged with Cygwin. Since I wanted to be able to open mintty from the command line in the current directory, so I added it to PATH and then just running mintty does the trick. While this causes it to open in the current directory the problem is that when I run any of the Ocaml executables like opam I get an error.
Marko#Lain /cygdrive/e/Webdev/Ocaml/todolist
$ opam
bash: opam: command not found
When I run it using mintty - like the shortcut does, this in fact works.
Marko#Lain ~
$ cd "E:\Webdev\Ocaml\todolist"
Marko#Lain /cygdrive/e/Webdev/Ocaml/todolist
$ opam
usage: opam [--version]
[--help]
<command> [<args>]
The most commonly used opam commands are:
init Initialize opam state, or set init options.
list Display the list of available packages.
show Display information about specific packages.
install Install a list of packages.
remove Remove a list of packages.
update Update the list of available packages.
upgrade Upgrade the installed package to latest version.
config Display configuration options for packages.
repository Manage opam repositories.
switch Manage multiple installation prefixes.
pin Pin a given package to a specific version or source.
admin Tools for repository administrators
See 'opam help <command>' for more information on a specific command.
What do I have to do so that I get this behavior normally?
Also, since mintty runs a terminal in a standalone window, it would be better to run bash, but bash - does not work for me. After I get this to work, I'd like to add bash to my list of VS Code shells and for that I'd need to understand how to run it in an arbitrary directory from the command line while keeping its memory of the home environment.
This command mintty - start your shell as login one.
If you run a not-login shell, most of the configuration script are not read, and enviroment is taken from the father process, but of course your link fails as Windows can not provide a proper one.
If you want to be able to open a login shell from explorer the best way is to install chere package
$ chere -h
/usr/bin/chere version 1.4
Usage:
/usr/bin/chere -<iuxlrhv> [-lracnmpf12] [-t <term>] [-s <shell>]
[-d <display> ] [-o <options>] [-e <menutext>]
Adds the stated terminal/shell combination to the folder context menu
This allows you to right click a folder in Windows Explorer and open
a Cygwin shell in that folder.
Options:
i - Install
u - Uninstall
x - Freshen eXisting entries
l - List currently installed chere items
r - Read all chere registry entries to stdout
a - All users
c - Current user only
n - Be Nice and provide Control Panel uninstall option (Default)
m - Minimal, no Control Panel uninstall
p - Print regtool commands to stdout rather than running them
f - Force write (overwrite existing, ignore missing files)
1 - Start using registry one-liners. This doesn't work with ash,
tcsh or network shares.
2 - Start via bash script. Relies on windows to change directory,
and login scripts avoiding doing a cd /home/Marco
h - Help
v - Version
t <term> - Use terminal term. Supported terminals are:
cmd rxvt mintty xterm urxvt
s <shell> - Use the named shell. Supported shells are:
ash bash cmd dash fish mksh pdksh posh tcsh zsh passwd
d <display> - DISPLAY to use (xterm, urxvt). Defaults to :0.
Set to env to use the runtime environment variable.
o <options> - Add <options> to the terminal startup command.
If more than one option is specified, they should all be
contained within a single set of quotes.
e <menutext> - Use <menutext> as the context menu text.
See the man page for more detail.
You can than install your preferred or default shell on explorer right click menu as an additional item. It will open a login shell in the chosen directory.
Please tell me how i can solve it. Iam using window 7 32 bit:
By default, Visual Studio Code runs shell commands like npm in a loginless shell. If you installed NVM, Visual Studio Code may have no indication where to find npm to run it.
Put the following lines are in .bash_profile: (Note: Not .bashrc.)
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
Add this setting to settings.json:
"terminal.integrated.shellArgs.linux": ["-l"]
On Mac OS , I switched to the zsh and got this fixed. These following steps fixed the issue :
On your VsCode in Mac : shift + command + P .
On the Prompt > type : Terminal: Select Default Profile , then "Click it". Note, as you type you will find this option in the auto-complete .
Click the option for zsh or your desired shell.
Restart VSCode .
now npm will work in your vscode terminal.
I too had this issue.
To solve this follow the below steps.
Make sure you have npm installed
- go to command prompt & type npm -v
- if a version comes out it's installed, else go to https://nodejs.org/en/ and download same.
Then come to vs code and set deafult shell to cmd.
to do so,
- Press Ctrl+Shift+P and type Select Default Shell
- Select Command Prompt.
- Press Ctrl+`
- Type npm -v and see npm works. :)
I got this error after having just installed nodejs/npm, and the way i resolved, while still being able to use git bash terminal in vscode was to simply restart my computer (I hadn't done this after node installation).
I needed to kill the terminal in VS Code and restart a new terminal to get npm to show as installed.
As you're aware, you can configure your environment variables in windows at 2 levels.
At user level
At system level
When VS code is started, it picks the variables in path at a user level and not at system level because you haven't run the application as Administrator.
Just copy-paste your node path from System Variables to User Variables
This does the trick for windows.
Thanks.
If you just installed your node while your VScode was running. Restart your vscode it should start working.
You need to install npm first, https://www.npmjs.com/get-npm and make sure npm command is accessible using terminal/command prompt.
You can also use https://marketplace.visualstudio.com/items?itemName=eg2.vscode-npm-script This extension supports running npm scripts defined in the package.json file and validating the installed modules against the dependencies defined in the package.json.
On mac, I switched the default shell from bash to zsh and it fixed the issue.
I'm gonna add an answer just for help others because this question is 2 years old.
If you can run the npm start (NPM SCRIPTS below the Explorer view) but you are not able to launch the command with a shortcut: Then check npm extension is installed and/or enabled for the current workspace/folder.
Otherwise vsCode will not be able to run the script and you're going to get a message in a little box like this
command 'npm-script.start' not found
Maybe the NPM Scripts View below the explorer is not available without the plugin I'm not sure
For me, restarting VS code and even my PC didn't work, but after restarting VS code via "reload" (not restart, not refresh) from ctrl+shift+P, then in the top right of the terminal clicking the leftmost button and clicking "kill terminal" then restarting VS code it worked.
I had this issue too and I'm running QubesOS which uses virtualization.
I could manage to get it running until I'd a standalone VM.
That solved my problem.
Just mentioning for the ppl using virtualization like virtual box or VMware.
Is there a way to run npm commands from Sublime?
For instance, if I wanted to run npm install angular-ui-grid on the current folder in Sublime, how would I do that?
I've looked at posts that say I can build with Node in Sublime, but I don't think that means I can run npm install as if I was in a terminal.
I know you can run a Python terminal from Sublime with Ctrl+`, and you can open a command window at the current location, but is there any way to combine the two?
NOTE: Looking for a Windows cmd or powershell terminal.
I guess, you are looking for TerminalView
This is a Linux/macOS plugin for Sublime Text 3 that allows for terminals inside editor views. The plugin uses a pseudo-terminal to start the underlying shell which means it supports
Interactive applications
Auto-completion
Terminal shortcuts (ctrl+c, etc.)
Password prompt etc.
You can get this package here,
https://packagecontrol.io/packages/TerminalView
Hope this helps!