1

I have never built software from source, so forgive my complete ignorance on this subject. I was trying to determine what the difference would be between installing Node.js from the OS X Installer pkg vs unzipping the 64-bit binaries file (from the Node.js downloads page) and moving to /usr/local/ (then making sure permissions are correct, of course.) Below is the output from running a diff between the unzipped binaries directory path [binaries] and the installation path [install].

Can someone please explain what test files are, as well as the other differences in doing what I described above? Using the output to explain would be helpful to me.

Only in [binaries]: ChangeLog
Only in [binaries]: LICENSE
Only in [binaries]: README.md
Binary files [binaries]/bin/node and [install]/bin/node differ
diff -r [binaries]/bin/npm [install]/bin/npm
1,2c1
< #!/bin/sh
< // 2>/dev/null; exec "`dirname "$0"`/node" "$0" "$@"
---
> #!/usr/bin/env node
diff -r [binaries]/include/node/config.gypi [install]/include/node/config.gypi
10c10
<                  'node_prefix': '/',
---
>                  'node_prefix': '',
diff -r [binaries]/lib/node_modules/npm/bin/npm-cli.js [install]/lib/node_modules/npm/bin/npm-cli.js
1,2c1
< #!/bin/sh
< // 2>/dev/null; exec "`dirname "$0"`/node" "$0" "$@"
---
> #!/usr/bin/env node
Only in [install]/lib/node_modules/npm/node_modules/ansicolors: test
Only in [install]/lib/node_modules/npm/node_modules/ansistyles: test
Only in [install]/lib/node_modules/npm/node_modules/block-stream: test
Only in [install]/lib/node_modules/npm/node_modules/char-spinner: test
Only in [install]/lib/node_modules/npm/node_modules/child-process-close: test
Only in [install]/lib/node_modules/npm/node_modules/chmodr: test
Only in [install]/lib/node_modules/npm/node_modules/cmd-shim: test
Only in [install]/lib/node_modules/npm/node_modules/columnify/node_modules/wcwidth: test
Only in [install]/lib/node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore: test
Only in [install]/lib/node_modules/npm/node_modules/github-url-from-username-repo: test
Only in [install]/lib/node_modules/npm/node_modules/glob: test
Only in [install]/lib/node_modules/npm/node_modules/graceful-fs: test
Only in [install]/lib/node_modules/npm/node_modules/ini: test
Only in [install]/lib/node_modules/npm/node_modules/init-package-json/node_modules/promzard: test
Only in [install]/lib/node_modules/npm/node_modules/init-package-json: test
Only in [install]/lib/node_modules/npm/node_modules/lockfile: test
Only in [install]/lib/node_modules/npm/node_modules/lru-cache: test
Only in [install]/lib/node_modules/npm/node_modules/minimatch/node_modules/sigmund: test
Only in [install]/lib/node_modules/npm/node_modules/minimatch: test
Only in [install]/lib/node_modules/npm/node_modules/mkdirp/node_modules/minimist: test
Only in [install]/lib/node_modules/npm/node_modules/mkdirp: test
Only in [install]/lib/node_modules/npm/node_modules/nopt: test
Only in [install]/lib/node_modules/npm/node_modules/npm-install-checks: test
Only in [install]/lib/node_modules/npm/node_modules/npm-registry-client: test
Only in [install]/lib/node_modules/npm/node_modules/npm-user-validate: test
Only in [install]/lib/node_modules/npm/node_modules/npmconf/node_modules/config-chain/node_modules/proto-list: test
Only in [install]/lib/node_modules/npm/node_modules/npmconf/node_modules/config-chain: test
Only in [install]/lib/node_modules/npm/node_modules/npmconf: test
Only in [install]/lib/node_modules/npm/node_modules/npmlog: test
Only in [install]/lib/node_modules/npm/node_modules/once: test
Only in [install]/lib/node_modules/npm/node_modules/osenv: test
Only in [install]/lib/node_modules/npm/node_modules/read/node_modules/mute-stream: test
Only in [install]/lib/node_modules/npm/node_modules/read: test
Only in [install]/lib/node_modules/npm/node_modules/read-installed: test
Only in [install]/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data: test
Only in [install]/lib/node_modules/npm/node_modules/read-package-json: test
Only in [install]/lib/node_modules/npm/node_modules/request/node_modules/bl: test
Only in [install]/lib/node_modules/npm/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream: test
Only in [install]/lib/node_modules/npm/node_modules/request/node_modules/hawk/node_modules/boom: test
Only in [install]/lib/node_modules/npm/node_modules/request/node_modules/hawk/node_modules/cryptiles: test
Only in [install]/lib/node_modules/npm/node_modules/request/node_modules/hawk/node_modules/hoek: test
Only in [install]/lib/node_modules/npm/node_modules/request/node_modules/hawk/node_modules/sntp: test
Only in [install]/lib/node_modules/npm/node_modules/request/node_modules/hawk: test
Only in [install]/lib/node_modules/npm/node_modules/request/node_modules/node-uuid: test
Only in [install]/lib/node_modules/npm/node_modules/request/node_modules/qs: test
Only in [install]/lib/node_modules/npm/node_modules/retry: test
Only in [install]/lib/node_modules/npm/node_modules/rimraf: test
Only in [install]/lib/node_modules/npm/node_modules/semver: test
Only in [install]/lib/node_modules/npm/node_modules/tar: test
Only in [install]/lib/node_modules/npm/node_modules/text-table: test
Only in [install]/lib/node_modules/npm: test
jsejcksn
  • 27,667
  • 4
  • 38
  • 62

1 Answers1

0

General differences

Since pre-build binaries can be tested before being deployed (zipped), they don't have to include the tests in the zip to test it again after download.

The OS X (universal) installer will do various checks and depending on your system it will compile/download/install different files, depending on your system setup.
After the various steps it will verify the installed files using the test files, which basically contain a bit of programming so that node is able to understand how it can test the actual file.

The OS X binaries however have basically already been "installed" (on a building machine) and then just zipped up.

something build on OS X will work on all OS X's having a similar system build

If you compile/build the code yourself however, testing it can be quite useful to detect potential build errors.

The other small changes would have to do with the (slightly) different way the application was compiled/build on your system, in comparison to their build system.

"source"

Binary differences

The binary differences seem to only be the declaration (on the binaries file) that it's a shell application, followed by a commented-out line. the node_prefix value seems to be only used by the installer according to this github issue comment

Jonas D.
  • 361
  • 4
  • 18
  • I didn't build any of the files. Both were downloaded from the site I linked to in my question. – jsejcksn Oct 01 '14 at 05:42
  • I couldn't explain the config line change in that case (except for some sub-versionnumber difference), however the same reason is still implied for the testing part, compiling would test every compiled item using it's tests, and will probably (by default) not be included with the actual installation. – Jonas D. Oct 01 '14 at 06:07
  • So, you're saying, basically, that they included the test files by mistake in the .pkg installer? – jsejcksn Oct 01 '14 at 06:14
  • No, I'm saying the test files can be used by the installer / compiler to test if the compilation was successful, the only thing I can't explain is why node_prefix is `/` or nothing depending on download method (my guess is that it would have to do with global declaration of node, since an installer should be able to handle that part, but a zip can't do much about it :p – Jonas D. Oct 01 '14 at 06:18
  • I think that some of what you're saying is over my head. Isn't the installer just uncompressing files from within the pkg and then copying them into the correct directories? Are you saying that the pkg is simply the source and that the installer is building the files during installation? When I said that I was completely ignorant, I really meant it. What are tests? What is the prefix? – jsejcksn Oct 01 '14 at 06:26
  • I think the following will help you understand: http://en.wikipedia.org/wiki/Installer_%28OS_X%29 specifically `Installer also handles authentication, checks that packages are valid before installing them, and allows developers to run custom scripts at several points during the installation process.` to clarify: no the .pkg doesn't just copy files over, it sometimes compiles them, or makes checks for the existence of required dependencies, etc. Basically making your life easier. – Jonas D. Oct 01 '14 at 06:37
  • Thanks for the link to the article. I understand running custom scripts, but that article mentions nothing about compiling/building. I will research more on how the OS X Installer works and the structure of .pkg files, but I still don't understand your answer to my initial question. What are the tests? What is the referenced prefix? I am trying to understand what the differences are between the two installation methods I described. – jsejcksn Oct 01 '14 at 06:46
  • @pattern86 I've extended my original answer, do you start to get the picture? (I'm unable to ding anything reliable about the node_prefix though. But my educated guess would be that the config file could/will still change during the actual installation process. – Jonas D. Oct 01 '14 at 06:56
  • I understand your answer, but I'm wanting to know what the tests are in the Node package and why the remain after installation. I also want to know what the other differences are in the two methods, including the prefix, config, and binary differences. – jsejcksn Oct 01 '14 at 07:09
  • I awarded you the bounty on this because you're the only person who attempted to answer my question, although the answer you gave is presently incomplete. – jsejcksn Oct 04 '14 at 19:13
  • Hi, as stated I couldn't find any reliable source to those questions, and I'm pretty sure I explained the most important parts. I think the only way to get more answers (after roaming the web not finding more information) is to ask one of the node developers themselfs, and I'm guessing the answer you'll get will be along the lines of 'minor changes between our source and build machines' (just a guess though) (had a busy week), kind regards – Jonas D. Oct 12 '14 at 22:57