How do I install a package with npm with a different/custom module name

I want to install a specific revision from a github tarball named something like "mymodule" and name it something like "mymoduleTemp", and then load a potentially different version of it that will take the real name "mymodule".

So, how do I do the first thing? I'm looking for something like:

npm install https://github.com/me/mymodule/tarball/someTag -name mymoduleTemp

Is there any way to do that? A nice-to-have:

  • If mymodule already exists, it doesn't get clobbered when mymoduleTemp is installed (ie ideally the process wouldn't be to install as mymodule then rename the folder)

there was an issue filed on the npm-github repository requesting that feature.

read on here: https://github.com/isaacs/npm/issues/2943

One way would be to put it in your package json file and then run npm install... Something like this

"dependencies": {
    "public": "git://github.com/user/repo.git#ref",
    "private": "git+ssh://git@github.com:user/repo.git#ref"
}

Source:http://www.devthought.com/2012/02/17/npm-tricks/