Wednesday 26 June 2019

Installing Visual Studio Code on linux - non-root user


Based on a stack overflow answer:

  1. Download Visual Studio Code for Linux
  2. Copy it somewhere you are happy to extract it into and keep eg ~/bin
  3. Extract it: tar -xvf VSCode-linux-x64.tar.gz
  4. Add the executable to the system path eg export PATH=$HOME/bin/VSCode-linux-x64
  5. Run the code executable to open Visual Studio Code
  6. (Optional) add the export statement into your ~/.bashrc

Monday 24 June 2019

Installing node.js on a linux machine as non-root user

Follow these instructions to install node on a linux machine; no root privileges required.


We will install nvm (Node Version Manager) to allow us to install several versions of node onto the same machine:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash

This currently produces output as the following:

Resolving deltas: 100% (4737/4737), done.
* (HEAD detached at v0.33.1)
  master
=> Compressing and cleaning up git repository
Counting objects: 7495, done.
Delta compression using up to 16 threads.
Compressing objects: 100% (7440/7440), done.
Writing objects: 100% (7495/7495), done.
Total 7495 (delta 5009), reused 2259 (delta 0)
=> Appending nvm source string to /homes/sms67/.bashrc
=> bash_completion source string already in /homes/sms67/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm

Now add the following to your ~/.bashrc file (last two lines of the output above):

echo "export NVM_DIR=\"\$HOME/.nvm\"" >> ~/.bashrc
echo "[ -s \"\$NVM_DIR/nvm.sh\" ] && \. \"\$NVM_DIR/nvm.sh\"  # This loads nvm" >> ~/.bashrc

Then source your .bashrc

myhost: source ~/.bashrc

The help page for nvm can now be found by:

myhost: nvm --version
The command above hopefully returned soem output (how to page).  If so great we can now install a version of node:

myhost: nvm install node

Then to use our installed version:

myhost: nvm use node
Check your installed versions of node and npm using:

myhost: node -v
myhost: npm --version 
You should now be able to create your first node application, or write some protractor tests!