To check node_modules or not

158 views
Skip to first unread message

Adrian Lynch

unread,
Oct 29, 2014, 10:21:12 AM10/29/14
to nod...@googlegroups.com
Who puts their node_modules into source control and who doesn't.

It's been asked before, but this is more a show-of-hands question.

I'm fighting the corner to put them into SC and wondered what everyone else is doing.

This question and answers mentions pros and cons and has some nice links.

Thanks.

Adrian

Aria Stewart

unread,
Oct 29, 2014, 10:58:18 AM10/29/14
to nod...@googlegroups.com
I do not.

I'm happy with npm pack to generate deployable artifacts.

// ravi

unread,
Oct 29, 2014, 11:01:40 AM10/29/14
to nod...@googlegroups.com
On Oct 29, 2014, at 4:26 AM, Adrian Lynch <adrian...@concreteplatform.com> wrote:

Who puts their node_modules into source control and who doesn't.
It's been asked before, but this is more a show-of-hands question.
I'm fighting the corner to put them into SC and wondered what everyone else is doing.


I check node modules into Git. Also, I do not keep node_modules local within the app directory structure, but instead I use NODE_PATH. My reasons are simple: (1) my app’s external dependencies should be kept as minimal as possible, (2) disk space may be cheap but maintaining separate versions of modules is not, so a common node_modules across apps accessed via NODE_PATH is better for me.

—ravi


Dick Hardt

unread,
Oct 29, 2014, 12:42:35 PM10/29/14
to nod...@googlegroups.com
I do not. External modules are not source I am controlling

I use npm shrinkwrap to ensure the exact same version is deployed. 

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/D2932F30-46E1-4680-BE33-F81FA70E8B21%40g8o.net.

For more options, visit https://groups.google.com/d/optout.

Sam Roberts

unread,
Oct 29, 2014, 8:53:38 PM10/29/14
to nod...@googlegroups.com
I do commit them before deploy, but I do ***NOT*** commit them to the
dev branch (usually master).

Use a mirror branch containing the exact same source as master, but
with dependencies added, using git commit-tree.

Indirectly, anyhow, I use strong-build:
https://github.com/strongloop/strong-build/#commit-command, if you are
getting pressure to commit deps, use slb to avoid the madness of
100,000s of lines of thirdparty code in your working branches...

Some more discussion here:

http://strongloop.com/strongblog/node-js-deploy-production-best-practice/

shrinkwrap is guaranteed to fail when npm is down or unreachable

Sam

Floby

unread,
Oct 30, 2014, 5:42:49 AM10/30/14
to nod...@googlegroups.com
I do not.
I have a Jenkins building my apps, running tests and then calling `tar`
I deploy the tarballs.

Mehul Kar

unread,
Oct 30, 2014, 12:58:34 PM10/30/14
to nod...@googlegroups.com
Also do not. Correct me if I'm wrong, but don't some module compile differently
based on the system? I seem to remember running into a problem with modules
compiled installed on OSX (because that's what I develop on), and failing
in production/staging because that was running some linux. 

Adrian Lynch

unread,
Oct 30, 2014, 3:00:22 PM10/30/14
to nod...@googlegroups.com
That's one of the things we'll need to test for.

It's interesting that there's no one clear answer.

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.

// ravi

unread,
Oct 30, 2014, 3:35:18 PM10/30/14
to nod...@googlegroups.com
On Oct 30, 2014, at 12:58 PM, Mehul Kar <mehu...@gmail.com> wrote:

Also do not. Correct me if I'm wrong, but don't some module compile differently
based on the system? I seem to remember running into a problem with modules
compiled installed on OSX (because that's what I develop on), and failing
in production/staging because that was running some linux. 


Indeed, yes, since modules can produce binaries and compiled libraries. In my case, I have separate repos for node modules per platform.

—ravi


Acker Apple

unread,
Oct 30, 2014, 10:02:27 PM10/30/14
to nod...@googlegroups.com
We put everything into svn, node_modules included. Didn't find it worth the debate over what to do and the size is not a concern. In the case that we want to make a custom change without particpating in pull-requests or "whatever" that may come up, we treat our code as part of "our" company foundation and may come in need of rollback or what have you of version control.

_Acker Apple

Sam Roberts

unread,
Oct 31, 2014, 4:20:58 PM10/31/14
to nod...@googlegroups.com
> On 30 October 2014 16:58, Mehul Kar <mehu...@gmail.com> wrote:
>> Also do not. Correct me if I'm wrong, but don't some module compile
>> differently
>> based on the system?

On Thu, Oct 30, 2014 at 11:57 AM, Adrian Lynch
<adrian...@concreteplatform.com> wrote:
> That's one of the things we'll need to test for.

Yes, so the build process should do an `npm install --no-scripts`, and
then should pack up the addon c++ code, but NOT the compiled .node
file (which shouldn't exist, anyway, if you used `--no-scripts`).

slb does this: https://github.com/strongloop/strong-build#install-command

On the receive side the package should be prepared to run using npm
rebuild (which will involve *no network access*).

strong-pm does this on receive and redeploy of an app:
https://github.com/strongloop/strong-pm#life-cycle

Cheers,
Sam
Reply all
Reply to author
Forward
0 new messages