TLDR:
- How to make "custom" nodejs build
- How to use custom build node via nvm
- How to use custom build npm for native packages
-
"custom" build is a local binary archive
- set "DISTTYPE=custom" with "make" command
-
For trying the comming version of node with npm
- to check safely building our native packages
(refresh the repository)
$ cd $NODE_REPO
$ make distclean
$ git checkout master
$ git pull
build custom binary archives
$ ./configure --with-intl=full-icu --download=all
$ make -j4 DISTTYPE=custom CUSTOMTAG=pre BUILD_INTL_FLAGS=--with-intl=full-icu binary
$ make DISTTYPE=custom CUSTOMTAG=pre BUILD_INTL_FLAGS=--with-intl=full-icu tar-headers
(Not only "pre", any name is available to CUSTOMTAG.)
then the files generated as:
- node-v6.0.0-pre-darwin-x64.tar.gz
- node-v6.0.0-pre-headers.tar.gz
- the headers archive is required for building native packages
extract the custom binary to inside nvm
$ cd ~/.nvm/versions/node
$ tar xf $NODE_REPO/node-v6.0.0-pre-darwin-x64.tar.gz
$ mv node-v6.0.0-pre-darwin-x64 v6.0.0-pre
reopen terminal shell to find "v6.0.0-pre" at nvm ls
$ nvm ls
$ nvm use v6.0.0-pre
$ node -e "console.log(process.versions)"
use npm with --nodedir
option as:
$ npm install --nodedir=$NODE_REPO install iconv
(In the case, CUSTOMTAG=bb instread of pre because CUSTOMTAG=pre npm cannot accept the disturl)
set up files for a dist server
- to serve the custom headers.tar.gz and its SHASUMS256.txt
$ mkdir v6.0.0-bb/
$ cd v6.0.0-bb/
$ cp $NODE_REPO/node-v6.0.0-bb-headers.tar.gz ./
$ shasum -a 256 *.gz > SHASUMS256.txt
$ cd ../
start as http server like:
$ python3 -mhttp.server
(the http server started at port 8000)
Then use npm on other machines. e.g.:
$ npm install --disturl=http://thedistserver:8000 install iconv
NOTE:
node-v6.0.0 required nan >= 2.2.0 (failed to compile at nan.h of both nan-2.0.9 and nan-2.1.0)