Unable to install nvm on Mac - command-line

I used the following command to install nvm on Mac:
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
It did execute successfully but when I use
nvm install 10
command to install version 10, it throws an error stating -
zsh: command not found: nvm
I don't know how to fix this issue. Any help will be highly appreciated.

Did you add the lines to your .zshrc/.bashrc file and open a new terminal window? nvm installs as shell-script alias and needs a new terminal to be opened.
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

Related

How to install Homebrew on Jelastic

I needed to install a repository with brew on my Jelastic Environment, and I ended up facing many difficulties to achieve this, so I decided to share my solution here, hope it helps others out.
It has been a hell of a run, but here is the detailed procedure:
WARNING: ONLY USE THE PACKAGE INSTALLER OF POINT 1 AS LAST RESOURCE, IT CAN CAUSE MANY PROBLEMS.
For example: using it to install composer will downgrade your php binary to v5 permanently, and there is nothing you can do to fix it unless creating a new node, if you decide to use it, first clone your node to have a backup in case it destroyes everything.
Install this package installer following the instructions here: https://github.com/jelastic-jps/packages-installer :
Then use it to install gcc.
We need to install anaconda in order to update git and curl to a version recent enough to make brew at least run (src: https://stackoverflow.com/a/52561058/12181662 ) :
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh > Miniconda.sh bash Miniconda.sh -b -p ~/conda
Use anaconda to install git and curl (src: https://www.reddit.com/r/linux4noobs/comments/lzdo9n/comment/gq1fhak/?utm_source=share&utm_medium=web2x&context=3 ) :
source /var/www/conda/bin/activate
conda update conda
conda install git
conda install curl
conda deactivate
echo 'export PATH="/var/www/conda/bin:$PATH"' >> ~/.bash_profile
export PATH="/var/www/conda/bin:$PATH"
install brew locally (src: https://brew.sh/ ) :
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/var/www/.linuxbrew/bin/brew shellenv)"' >> /var/www/.bash_profile
eval "$(/var/www/.linuxbrew/bin/brew shellenv)"
echo 'export HOMEBREW_CURL_PATH="/var/www/conda/bin/curl"' >> ~/.bash_profile
export HOMEBREW_CURL_PATH="/var/www/conda/bin/curl"
echo 'export HOMEBREW_GIT_PATH="/var/www/conda/bin/git"' >> ~/.bash_profile
export HOMEBREW_GIT_PATH="/var/www/conda/bin/git"
install the most recent version of gcc using brew (src: https://github.com/Homebrew/homebrew-core/issues/101919#issuecomment-1162740031 ) :
brew install gcc#5
brew install --force-bottle gcc
fix brew install for the non-root locations (src: https://github.com/orgs/Homebrew/discussions/3421#discussioncomment-3126807 ) :
echo 'export HOMEBREW_RELOCATE_BUILD_PREFIX=1' >> /var/www/.bash_profile
export HOMEBREW_RELOCATE_BUILD_PREFIX=1
enjoy! Example: brew install composer
Also you can try to run this is you face any errors during installation of anything:
brew link --overwrite libxcrypt

correct PATH for zshrc in windows 10

I'm on Windows 10, installed WSL2 with Ubuntu v20 and then I installed Oh My Zsh. I thought I had everything working but when I went to type code ., in my Ubuntu terminal I got the error zsh: command not found: code.
When I do echo $PATH I get:
/home/robbie/.nvm/versions/node/v18.1.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/robbie/.yarn/bin
My .zshrc file looks like (I removed a bunch of the comments for this snippet):
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="agnoster"
plugins=(git node npm nvm z yarn)
source $ZSH/oh-my-zsh.sh
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
source /home/robbie/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
On VSCode I have the Remote WSL extension installed and set default/enabled on Ubuntu under Remote Explore.
In Windows 10 under Environment Variables, under Path I have a variable C:\Users\RobbieC\AppData\Local\Programs\Microsoft VS Code\bin
I have tried uncommenting export PATH=$HOME/bin:/usr/local/bin:$PATH - shutting down WSL, rebooting, no luck. I tried uninstalling/reinstalling the Remote WSL extension, rebooting computer, etc. No luck.
Open your regular Debian terminal App(Ensure you are in the debian home directory). Type ls -la there you will find the .zshrc file. Then remove the VScode Path you added.

How to open Visual Studio Code from the command line on RHEL?

I would like to open VSCode from my RHEL terminal using the code command but when I try to type Shell Command: Install 'code' command in PATH directly in VSCode Command Palette, it indicates that No matching command is found. Is there a way to configure $PATH directly via the command line to make code work?
Finally what worked for me was to run the following commands :
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
dnf check-update
sudo dnf install code

Installing Network-x

How do I download and install network-x for python version 3.4.0 on mac? Can someone give me a step by step guide on installing network-x? I tried to quick 'quick install' as suggested by github.
When I try to import it on python it gives me an import error saying no modules were found.
Ok so I have figured out an easier way:
(Answering my own question)
I first download the networkx-1.10.zip (md5) zip file from https://pypi.python.org/pypi/networkx. Unzipped it. Opened the terminal and typed cd
Then, I dragged and dropped the unzipped folder (networkx-1.10) into the terminal. Hit Enter.
Then I proceeded with the following commands:
python3 --version
ls
umask
sudo python setup.py install
sudo python3 setup.py install
python3
It worked like a charm.
this has worked for me
sudo pip install networkx
This should work:
sudo pip3 install networkx
if you have annaconda, in your terminal or cmd
> % conda install -c anaconda networkx
> % conda install -c anaconda graphviz
> % conda install -c anaconda pydot
> % conda install -c pdrops pygraphviz
The other packages come in handy as well
The easiest way is using Anaconda, since networkX is installed by default. Just follow the instructions on their website (they have both a graphical and command line installer).

How can I run madge on Windows

The instructions for madge are only good for a linux system (it requires sudo to get the command line part set up). Is there a way to run it on windows?
It turns out to be very simple. To install madge:
npm install madge
Then to set it up for the command line:
npm -g install madge
You can then run it with a command of:
madge
For typescript generate .js files do:
madge -f amd -c .
and you'll get the circular report. You need the "-f amd".