Using Chromebook for node.js development
Every single working day I spend between 2 and 2.5 hours in a train. And I feel pretty lucky about this, mostly because is one single train, no need to pay attention for switch overs or other kind of public transports, and that allows me to invest that time in whatever task I want: podcasts, videos, blogging or even programming. And that’s what I want this post to focus in, because there are plenty of posts that explain how to use a Chromebook for day-to-day tasks (even being offline) but not that many that talk about programming in node.js using a Chromebook.
There are two main challenges we have to figure out when using a Chromebook (CB) for usual programming tasks:
- Connectivity
- A proper development environment
Connectivity is a big issue because, despite of there are quite a few web IDEs or even environments that expose a whole virtual machine, they often require a connection in order to work.
On the other hand, as a developer I want to use the best tools possible in order to achieve my goals, a proper development environment, and that for me means having:
- A linux shell
- tmux (not a must, but really nice to have)
- vim
- git
- node.js virtual machine (managed with nvm if possible)
It turns out that CB really suck in this point, so my idea when I bought this platform was to create a tiny partition and install a Linux OS there with all this requirements. But I was surprised when I heard about crouton: this amazing tool creates chroot environments within the very ChromeOS (which is a Linux underneath), where you can do whatever (well, almost) you want. All you need is root access (Developer mode in ChromeOS jargon) and some free space (but really not that much).
I’m not going to explain how to get this chroot environment up and running. There are plenty of posts and tutorials that explain this process. Just a quick spoiler: it’s super easy and takes no more than 15 minutes.
Once you have a chroot with at least crouton cli-extra, getting the rest of the tools up and ready is easy peasy. Use apt-get install to get tmux, vim and git, download nvm and fetch latest node.js binary. Integrate all of this into your bash scripts, so you don’t need to setup nvm with every login and you’re good to go.
< self-promotion >
Last but not least, setup your config files for vim, git, ssh, bash… or use one handy opensource tool (developed in node.js using a ChromeBook) call dotback. Just install it using npm:
npm install -g dotback
And setup your configuration definition file.
dotback --action install
Or if you already have done that and it’s available through a git repository, fetch it using:
dotback --action init REPO_URL
Takes a little bit to tune, but once it’s done, you’ll see the effort was worth of it.
< / self-promotion >
And that’s how I got a really portable box, with enough power for node.js development, and really really light, which is good if you have to carry it with you almost all the time 🙂
I hope you liked my Chromebook & Node.js feedback and that it helped you to decide if you’re thinking about getting a Chromebook or not, and as I was, were worried about being able to use it as a developer environment.