I am building an npm package (libsbmlsim) that installs binaries that I will later be using server side.
The package builds just fine when I run npm install, however, when I use it as a dependency in a different project via npm install libsbmlsim, it fails to find one of the binaries that it depends on (cmake):
/bin/sh: ../../node_modules/cmake/bin/cmake: No such file or directory
make: *** [all] Error 127
npm ERR! libsbmlsim@0.0.2 install: `make`
npm ERR! `sh "-c" "make"` failed with 2
npm ERR!
npm ERR! Failed at the libsbmlsim@0.0.2 install script.
I suspect it has to do with my setup, so I will explain it a bit here. libsbmlsim depends on a few other binaries (cmake and libsbml), that I also have as bundled as npm packages which I bring in as dependencies or npm install cmake etc. I set the install script in the package.json files of each package to run make, and I have a corresponding Makefile that downloads the binaries.
Again, this works when I run npm install when I have libsbmlsim as its own project but it fails to install when it is installed as a dependency, i.e. npm install libsbmlsim.
Here is my Makefile:
all:
wget http://fun.bio.keio.ac.jp/software/libsbmlsim/downloads/libsbmlsim-1.1.0.tar.gz
tar -xvzf libsbmlsim-1.1.0.tar.gz
mkdir -p libsbmlsim-1.1.0/build
cd libsbmlsim-1.1.0/build; export PATH=../../node_modules/cmake/bin:$(PATH); cmake .. -DCMAKE_INSTALL_PREFIX=../../libsbmlsim -DLIBSBML_INCLUDE_DIR=../../node_modules/libsbml/include -DLIBSBML_LIBRARY=../../node_modules/libsbml/lib64/libsbml.so
cd libsbmlsim-1.1.0/build; export PATH=../../node_modules/cmake/bin:$(PATH); make -j4
cd libsbmlsim-1.1.0/build; make install;
rm -rf libsbmlsim-1.1.0
rm *.tar.gz
Source is available here: https://github.com/stanley-gu/libsbmlsim
Unless you've published your module to the npm registry (npm publish), you'd need to look at npm link during development.
more details http://howtonode.org/introduction-to-npm (somewhat sparse)