Rebuilding a fresh version of the TM351 VM from scratch yesterday, I got an error trying to install tty.js, a node.js app that provides a “terminal desktop in the browser”.
Looking into a copy of the VM where tty.js does work, I could discover the version of node I’d previously successfully used, as well as check all the installed package versions:
### Show nodejs version and packages > node -v v0.10.35 > npm list -g /usr/local/lib ├─┬ firstname.lastname@example.org │ ├── email@example.com │ ├── firstname.lastname@example.org │ ├── email@example.com │ ├── firstname.lastname@example.org │ ├── email@example.com │ ├── firstname.lastname@example.org ... │ └── email@example.com └─┬ firstname.lastname@example.org ├─┬ email@example.com │ ├── firstname.lastname@example.org ...
Using this information, I could then use nvm, a node.js version manager, installed via:
curl https://raw.githubusercontent.com/creationix/nvm/v0.23.3/install.sh | NVM_DIR=/usr/local/lib/ bash
to install, from a new shell, the version I knew worked:
nvm install 0.10.35
npm install tty.js
(I should probably add the tty.js version in there too? npm install email@example.com perhaps? )
The terminal can then be run as a demon from:
/usr/local/lib/node_modules/tty.js/bin/tty.js --port 3000 --daemonize
What this got me wondering was: are there any utilities that let you capture a nodejs configuration, for example, and the recreate it in a new machine. That is, export the node version number and versions of the installed packages, then create an installation script that will recreate that setup?
It would be handy if this approach could be extended further. For example, we can also look at the packages – and their version numbers – installed on the Linux box using:
### Show packages
And we can get a list of Python packages – and their version numbers – using:
### Show Python packages
Surely there must be some simple tools/utilities out that support this sort of thing? Or even just cheatsheets that show you what commands to run to export the packages and versions into a file in a format that allows you to use that file as part of an installation script in a new machine to help rebuild the original one?