virtual terminals in ubuntu server do not recognize newly installed nvm - node.js

Ubuntu server (as all linuxes) has the ability to multitask using ctrl-F1 up to ctrl-F7. Each of these key combos puts you in another terminal. While in the main terminal (ctrl-F1) I installed nvm (node version manager) and also node.js. These work fine in the ctrl-F1 terminal. But when I go to another terminal, ubuntu thinks they are not installed. ECHO $PATH gives the same result in all virtual terminals. Default programs like nano, vim, etc can be started in all the different terminals. How can I 'fix' this issue so that I can run learnyounode in one terminal, nano in another terminal, and node in another terminal?

If you have shells running on those terminals which were initiated before you ran the installer, they will not have received the updated configuration. Log out and then back in, or figure out which configuration file(s) to source anew. Probably
. ~/.bashrc
but there could be pertinent changes in .bash_profile and/or .profile as well (and system config files, if you did a system-wide install).

Related

after installing node, node is not detected when first open terminal

i install node in zsh terminal.. node sucessfully installed
but to use it i have to switch in bash terminal then switch again to zsh terminal
i dont know why this happen.
beside solution can you tell me whats happening in background
i expect to use node without switch between bash first and switch again to zsh
Since you haven't mentioned how you installed node and what all steps you've tried, my hunch is that the config isn't loaded in your zsh session.
Could you try to reload your zsh config?
Try this command in zsh terminal:
exec $SHELL -l
Judging by what you mentioned, it looks like node is installed in your system and is in the path as well, but the terminal config isn't loaded.
If this command doesn't solve the issue, I'd suggest:
Quit all the instances of the terminal and then open a fresh terminal
and try.
Try to reboot your system (if you haven't already) and try once.
P.S: I'm not entirely sure what you mean by "i install node in zsh terminal". How did you set it up so that it only works in zsh and not the bash one?

nvim started as desktop application | :checkhealth - commands not available

When I start neovide from my applications and run :checkhealth I get errors that node and other commands are not available. But when I start it from my terminal there is no error for those commands. I tried to copy and modify the neovide desktop file to start just nvim and see if there if something wrong with my my neovide installation. But also starting just nvim as application prints the same errors.
I'm using linux with plasma desktop
TL:DR; add a path variable
Depending on your configuration, nvim will need to know the environment to run some executables (like it is with node in your example). An easy solution is to add the path variable to the exec command in the according .desktop file. I remember that I had the same issue with node not being recognized in a configuration using my plasma installation. On gnome node was recognized and healthchecks were good, so I thought I didn't need the extra path. Later on I realized that I had trouble with other commands. E.g. when using fdfind to complete path commands. Again I had to search what the reason was and it also was the missing path.
To give an example, let's say you are using zsh and want to start neovide with multigrid enabled, the Exec line in your desktop file could look like:
Exec=zsh -c "source ~/.config/zsh/.zshrc && neovide --multigrid %F"

WSL-2 `code` command installs vscode instead of using local windows install

I have a local vscode installed for windows.
Afterwards I setup wsl-2 and use it as my shell.
When I tried to open a file with code using the code filename command, it installed vscode anew instead of using the local windows install.
Installing VS Code Server for x64 (054a9295330880ed74ceaedda236253b4f39a335)
Is there a way to point wsl to use the windows install when triggering it via the code command?
I don't specifically mind using either or, but settings/extensions etc. for one are not used by the other.
By checking with Git Bash where the location of code is when triggering it (type -a code) and comparing it to the ubuntu wsl shell, I came to the conclusion, that it is actually the same install that is being triggered, . I will have to check why some extensions do not seem to "carry over" though.
The code that is being triggered is a script, that behaves differently when being triggered from within WSL.
How about an alias?
# Set alias
alias code2='/mnt/c/Users/Username/AppData/Local/Programs/Microsoft\ VS\ Code/bin/code'
# Open a file now
code2 file.txt

How do I create a shortcut for a command line command in Raspbian Stretch?

I am attempting to install RetroPie as an app on Raspbian Stretch and I am done except for creating a desktop shortcut for it. The problem is that the only way to open RetroPie seems to be running a command in the command line. I can’t do it in terminal because it gives me an error saying that it can’t initialize the window. Is there a way to run a command line command as a shortcut or am I going to have to find another way of doing this?
P.S. Here is the tutorial that I followed to install RetroPie:
https://www.makeuseof.com/tag/install-retropie-app-raspberry-pi/
Probably your shell (on the raspberry) is GNU bash. So read the manual of GNU bash.
You probably want (once) to edit some Bash startup file (such as ~/.bashrc) to define functions and aliases there, and you could add executable shell scripts somewhere in your $PATH. I recommend having a $HOME/bin/ directory containing your scripts and executables, and have $HOME/bin/ early in your $PATH.
I can’t do it in terminal because it gives me an error saying that it can’t initialize the window.
Perhaps you need some display server (such as Xorg or Wayland) running (with a desktop environment or a window manager). You could run Xorg on your PC (on which you could install Linux) and connect to the raspberry using ssh -X then remote applications running on your Raspberry are displayed on your PC. IF your Raspberry is directly connected to a screen (via HDMI) you might run some Xorg server on it.
Is there a way to run a command line command as a shortcut
Yes, by making a shell alias or shell function or shell script. You need to understand how they work and change or create some appropriate file using some source code editor (I recommend GNU emacs, but the choice is yours and you might use any other editor such as vim, gedit, etc...): functions and aliases could be defined in your ~/.bashrc; shell scripts would usually have their own file with a shebang under your $HOME/bin/...

Cygwin Terminal shell stopped working properly

cygwin64 had been running great on my Windows 7 system for several months. After rebooting this morning, it appeared to be inexplicably broken. When I started a new mintty session, rather than presenting a window with my familiar bash prompt, I got a blank window entitled -sh.exe. Sure enough, despite the lack of any sort of prompt, it was a shell window. ls, pwd, cd, and other commands worked, but my environment was a mess. Aside from the lack of a prompt, my home directory, path, and other things were messed up.
I tried the normal things. I reran cygwin setup to no avail. I completely uninstalled and reinstalled cygwin, again with no discernible effect. I rebooted a number of times during all these tries. What could cause cygwin to suddenly begin behaving so badly?
I had similar issues after installing IBM InfoSphere DataStage, which causes Cygwin to misbehave because it is setting several Windows environment that are inherited by Cygwin, and are crucial to Mintty and the shell. These variables are: SHELL, TERM, TERMCAP, and TERMINFO.
I modified my Mintty shortcut to contain the following target, and this fixed the issues:
C:\cygwin\bin\mintty.exe /bin/env -u SHELL -u TERMCAP -u TERMINFO - TERM=xterm-256color HOME=/home/username /bin/bash -i -l
The -u options are unsetting those variables, and then I'm explicitly setting TERM and HOME (make sure to use your home directory instead of /home/username).
I also had to copy my ~/.minttyrc file to /etc/minttyrc so that mintty would see it.
After digging around, I noticed that the sh.exe that was running was not in /cygwin64/bin, but was instead in \Program Files (x86)\MKS Toolkit. I did not recall installing MKS, but the date on this directory was from the previous day. The only thing I'd recently installed was the IBM InfoSphere DataStage client. It turns out, InfoSphere not only installs the MKS Toolkit, it prepends it to a number of environment variables, totally hosing cygwin.

Resources