Updated node build script to avoid unnecessary rebuilds.

Unfortunately, node-gyp does not a good job considering dependencies of
target actions.