I was trying to use n in a provisioning script for a Vagrant box to install node.js. There is a really handy install script called n-install and I had decided to go with that to install any version of node.js/io.js in one line like this:
# install io.jscurl -L http://git.io/n-install | bash -s -- -y io:latestsource $HOME/.bashrc
I had to source the .bashrc
to set some environment variables for n
and add it to the PATH
. This never worked and I couldn't figure out why until I opened an issue on GitHub and found a StackOverflow post mentioning a potential issue.
The problem is that the default .bashrc
contains this line at the very top:
# If not running interactively, don't do anything[ -z "$PS1" ] && return
So the relevant lines that setup n
never get executed. I have found this to be the case for ubuntu/precise64
and ubuntu/trusty64
boxes.
I haven't found a way to source the .bashrc
without breaking anything, so I am going to be using a different install method for n
in the meantime. If I make a discovery, I will update this post.
Hi, I’m Max! I'm a fullstack JavaScript developer living in Berlin.
When I’m not working on one of my personal projects, writing blog posts or making YouTube videos, I help my clients bring their ideas to life as a freelance web developer.
If you need help on a project, please reach out and let's work together.
To stay updated with new blog posts, follow me on Twitter or subscribe to my RSS feed.