I've added the node_modules folder to my .gitignore file, which works fine thanks to NPM Shrinkwrap (after deploying I need to run npm install using the shrinkwrap.json file).
However, I've got some private modules now that I won't publish to NPM. I would like to require these modules like the other modules in node_modules.
Unfortunately I cannot put these modules in node_modules, because they'd be ignored by git, messing with my future deployment.
Where should I place these modules instead? I've been told that editing the paths variable for node's module lookup is highly unrecommended.
Note that these are small undocumented nonpublic modules, which is why I don't want to publish them to NPM.
On Wednesday, October 10, 2012 at 16:09 , Tom wrote:
> I've added the node_modules folder to my .gitignore file, which works fine thanks to NPM Shrinkwrap (after deploying I need to run npm install using the shrinkwrap.json file).
> However, I've got some private modules now that I won't publish to NPM. I would like to require these modules like the other modules in node_modules.
> Unfortunately I cannot put these modules in node_modules, because they'd be ignored by git, messing with my future deployment.
> Where should I place these modules instead? I've been told that editing the paths variable for node's module lookup is highly unrecommended.
> Note that these are small undocumented nonpublic modules, which is why I don't want to publish them to NPM.
where TAG is a named git tag (version), a branch name, or a commit sha. I would recommend using a named git tag (version) for best flexibility.
Once you have added something to package.json, you can install simply be doing `npm install` and it will pull it down from github as a tarball just as if it came from npm.
> 1. Change your .gitignore > 2. Change your require() calls
> Example for 1: > (instead of having "node_modules")
> node_modules/a > node_modules/b > ...
> Example for 2: > (in case you put your module in priv_modules)
> var xpto = require("./priv_modules/xpto");
> -- > Diogo Resende
> On Wednesday, October 10, 2012 at 16:09 , Tom wrote:
> I've added the node_modules folder to my .gitignore file, which works fine > thanks to NPM Shrinkwrap (after deploying I need to run npm install using > the shrinkwrap.json file).
> However, I've got some private modules now that I won't publish to NPM. I > would like to require these modules like the other modules in node_modules.
> Unfortunately I cannot put these modules in node_modules, because they'd > be ignored by git, messing with my future deployment.
> Where should I place these modules instead? I've been told that editing > the paths variable for node's module lookup is highly unrecommended.
> Note that these are small undocumented nonpublic modules, which is why I > don't want to publish them to NPM.
On Wednesday, October 10, 2012 8:09:27 AM UTC-7, Tom wrote:
> I've added the node_modules folder to my .gitignore file, which works fine > thanks to NPM Shrinkwrap (after deploying I need to run npm install using > the shrinkwrap.json file).
> However, I've got some private modules now that I won't publish to NPM. I > would like to require these modules like the other modules in node_modules.
> Unfortunately I cannot put these modules in node_modules, because they'd > be ignored by git, messing with my future deployment.
> Where should I place these modules instead? I've been told that editing > the paths variable for node's module lookup is highly unrecommended.
> Note that these are small undocumented nonpublic modules, which is why I > don't want to publish them to NPM.
On Wednesday, October 10, 2012 8:09:27 AM UTC-7, Tom wrote:
> I've added the node_modules folder to my .gitignore file, which works fine > thanks to NPM Shrinkwrap (after deploying I need to run npm install using > the shrinkwrap.json file).
> However, I've got some private modules now that I won't publish to NPM. I > would like to require these modules like the other modules in node_modules.
> Unfortunately I cannot put these modules in node_modules, because they'd > be ignored by git, messing with my future deployment.
> Where should I place these modules instead? I've been told that editing > the paths variable for node's module lookup is highly unrecommended.
> Note that these are small undocumented nonpublic modules, which is why I > don't want to publish them to NPM.
If you want it to be managed by npm, use git+ssh:// scheme, that works. But there are several issues with that. For example, if you use npm update, it will try to update your private package from repository. And if there's a package with the same name, you will have trouble.
š
Another way is to put these packages to another folder, say my_modules and invoke node.js with node_path env like that:
NODE_PATH=my_modules node server.js
This way you can safely separate private modules from the public ones.
-- // alex
š
š
10.10.2012, 19:09, "Tom" <tommedema@gmail.com>:
I've added the node_modules folder to my .gitignore file, which works fine thanks to NPM Shrinkwrap (after deploying I need to run npm install using the shrinkwrap.json file).
However, I've got some private modules now that I won't publish to NPM. I would like to require these modules like the other modules in node_modules.
Unfortunately I cannot put these modules in node_modules, because they'd be ignored by git, messing with my future deployment.
Where should I place these modules instead? I've been told that editing the paths variable for node's module lookup is highly unrecommended.
Note that these are small undocumented nonpublic modules, which is why I don't want to publish them to NPM.
I had to do this a couple of months ago, and I found that using a private
repo for code and building tagged releases using "npm pack" worked well for
me.
The company I was working for stored all of its deployment packages in
Amazon S3. We considered using the git+ssh approach, but our general
approach to managing releases (with other technologies) was to build
archival packages, so installing from a tarball worked well for us.
On Wednesday, October 10, 2012 5:09:27 PM UTC+2, Tom wrote:
> I've added the node_modules folder to my .gitignore file, which works fine > thanks to NPM Shrinkwrap (after deploying I need to run npm install using > the shrinkwrap.json file).
> However, I've got some private modules now that I won't publish to NPM. I > would like to require these modules like the other modules in node_modules.
> Unfortunately I cannot put these modules in node_modules, because they'd > be ignored by git, messing with my future deployment.
> Where should I place these modules instead? I've been told that editing > the paths variable for node's module lookup is highly unrecommended.
> Note that these are small undocumented nonpublic modules, which is why I > don't want to publish them to NPM.
You can .gitignore node_modules but still manually check in files under
node_modules. Git will just ask you to add a -f flag if you really mean to
check those in.
We do this for our own private modules. (Actually, what we check into
node_modules are just symlinks. Our modules live in their own directories
alongside the requiring module.)
> On Wednesday, October 10, 2012 5:09:27 PM UTC+2, Tom wrote:
>> I've added the node_modules folder to my .gitignore file, which works
>> fine thanks to NPM Shrinkwrap (after deploying I need to run npm install
>> using the shrinkwrap.json file).
>> However, I've got some private modules now that I won't publish to NPM. I
>> would like to require these modules like the other modules in node_modules.
>> Unfortunately I cannot put these modules in node_modules, because they'd
>> be ignored by git, messing with my future deployment.
>> Where should I place these modules instead? I've been told that editing
>> the paths variable for node's module lookup is highly unrecommended.
>> Note that these are small undocumented nonpublic modules, which is why I
>> don't want to publish them to NPM.
On Fri, Oct 12, 2012 at 9:27 AM, Aseem Kishore <aseem.kish...@gmail.com> wrote:
> Surprised no one has mentioned this yet:
> You can .gitignore node_modules but still manually check in files under
> node_modules. Git will just ask you to add a -f flag if you really mean to
> check those in.
> We do this for our own private modules. (Actually, what we check into
> node_modules are just symlinks. Our modules live in their own directories
> alongside the requiring module.)
> Aseem
> On Thu, Oct 11, 2012 at 4:37 AM, Mariusz Nowak <mari...@medikoo.com> wrote:
>> On Wednesday, October 10, 2012 5:09:27 PM UTC+2, Tom wrote:
>>> I've added the node_modules folder to my .gitignore file, which works
>>> fine thanks to NPM Shrinkwrap (after deploying I need to run npm install
>>> using the shrinkwrap.json file).
>>> However, I've got some private modules now that I won't publish to NPM. I
>>> would like to require these modules like the other modules in node_modules.
>>> Unfortunately I cannot put these modules in node_modules, because they'd
>>> be ignored by git, messing with my future deployment.
>>> Where should I place these modules instead? I've been told that editing
>>> the paths variable for node's module lookup is highly unrecommended.
>>> Note that these are small undocumented nonpublic modules, which is why I
>>> don't want to publish them to NPM.