(source: https://askubuntu.com/a/1291854) I executed the following commands (May 2022):
sudo apt update curl -sL https://deb.nodesource.com/setup_14.x | sudo bash - sudo apt install -y nodejs node -v
After running the last command I saw:
$ node -v v14.19.2
However, due to what I am almost confident are broken dependencies issues among my packages, the installation of node messed up my npm and I was unable to re-install it with conventional means. As such, I had to download the node tarball from here, explode the tarball in a directory and set in my PATH the path to node-v14.16.0-linux-x64/bin (wherein the npm executable is to be found). This was mighty iffy and unsettling.
npm install -g npm-check-updates ncu -u npm update # use this if node_modules already exists npm install # use this otherwise
I've used the nodemon package for that. See target monitor in package.json in my ora2pg migration assessment github project
I tried this to update to the latest major version and it worked like a charm.
By combining this SO answer with that SO answer, one can arrive at the following solution:
export npm_config_cache=$(shell mktemp -d) install: @printf "using throw-away cache at: [$$npm_config_cache]\n" npm install @du -h $$npm_config_cache | printf "size of temp cache is: $$(du -h . | tail -1 | cut -f1)\n" @rm -fr $$npm_config_cache @printf "temporary cache at: $$npm_config_cache is now deleted.\n" clean: rm -fr node_modules/ rm -f es5/*.js rm -f es5/*.map npm cache -f clean # this is not really necessary as we're using a throw-away cache
npm run foo --ignore-scripts
npm publish --ignore-scripts
npm
installed) export NODE_PATH=$NODE_PATH:~/.node_modules_global/lib/node_modules
var fs = require('fs'); // file is included here: eval(fs.readFileSync('file-to-include.js')+'');
$ node > fs = require('fs'); > fs.writeFileSync('fs.js', fs.toString()) > fs.writeFileSync('fs.readFileSync.js', fs.readFileSync.toString()) [Ctrl-C][Ctrl-C]
sudo npm install npm@3 -g $ npm -version 3.8.0
apt-key adv --keyserver keyserver.ubuntu.com --recv 68576280 apt-add-repository 'deb https://deb.nodesource.com/node_4.x precise main' apt-get update apt-get install nodejs
$ ls /usr/bin/node lrwxrwxrwx 1 root root 22 Mar 7 10:23 /usr/bin/node -> /etc/alternatives/node* $ ls /etc/alternatives/node lrwxrwxrwx 1 root root 15 Mar 7 10:23 /etc/alternatives/node -> /usr/bin/nodejs*
~/playground/repo-wide-scripts
).
Guardfile
Gemfile
to be usedsudo gem install guard-livereload
sudo apt-get install bundler
ln -s ~/playground/repo-wide-scripts/Gemfile
ln -s ~/playground/repo-wide-scripts/Guardfile
ln -s ~/playground/repo-wide-scripts/run-guard
run-guard
which ultimately
links to this script).
npm
tool in the home folder as described
here.
However with this approach, one (at least in Ubuntu 14.04) cannot use the nodejs
executable
but has to use the node
one that is available with the nvm
tool.
This is described here in the section "How to Install Using NVM".
NB:I actually had to use sudo curl .. | sh
to install it.
npm prompt
to also do nvm link prompt
(as described in the link above). An example is given in:
~/playground/javascript-you-dont-know