Is "linking" possible?
cowboy opened this issue · comments
I'm sure this is working as-expected, but I'm going to throw my issue out there just in case.
When I "create a named env, using the specified version" via nave use <name> <ver>
, it creates a copy instead of a link. What that means is that any time I npm install -g
or npm update -g
in the named env, those changes aren't propagated to the version-based env.
$ nave install stable
######################################################################## 100.0%
installed from binary
$ nave use default stable
Creating new env named 'default' using node 0.10.33
Already installed: 0.10.33
$ npm install -g linken
/home/cowboy/.nave/installed/default/bin/linken -> /home/cowboy/.nave/installed/default/lib/node_modules/linken/bin/linken
linken@0.2.1 /home/cowboy/.nave/installed/default/lib/node_modules/linken
├── semver@1.1.4
├── mkdirp@0.3.5
├── rimraf@2.0.3 (graceful-fs@1.1.14)
└── nopt@2.0.0 (abbrev@1.0.5)
$ which linken
/home/cowboy/.nave/installed/default/bin/linken
$ exit
exit
$ nave use default which linken
/home/cowboy/.nave/installed/default/bin/linken
$ nave use stable which linken
Already installed: 0.10.33
using 0.10.33
failed with code=1
Is there any way to create a named env that is a link to a specified version? Right now I have a bash function that creates a symlink, which I add into my PATH to facilitate always have the latest stable version available by default.
# Set a specific version of node as the "default" for "nave use default"
function nave_default() {
local version
local default=${NAVE_DIR:-$HOME/.nave}/installed/default
[[ "$1" == "stable" ]] && version=$(nave stable) || version=${1#v}
rm "$default" 2>/dev/null
ln -s $version "$default"
echo "Nave default set to $version"
}
# Put the "default" nodejs install bin directory in the PATH
PATH=~/.nave/installed/default/bin:$PATH
# Install stable and make it the "default"
nave install stable
nave_default stable
Is the "link" idea useful enough to add into nave itself?
I'm not understanding the point of this.
The idea of a named env is that you can change the version, and whatever you install in the named env is not going to be shared by anything outside it. What you're asking for is a way to have a single logical env have multiple names, which seems like kinda the opposite of what nave is for.