1

我正在构建一个 npm 包 ( libsbmlsim) 来安装我稍后将在服务器端使用的二进制文件。

该包在我运行时构建得很好npm install,但是,当我通过 将它用作不同项目中的依赖项时npm install libsbmlsim,它无法找到它所依赖的二进制文件之一(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.              

我怀疑这与我的设置有关,所以我将在这里稍微解释一下。libsbmlsim依赖于其他一些二进制文件(cmakelibsbml),我还捆绑了作为依赖npm install cmake项等引入的 npm 包。我在每个包的 package.json 文件中设置了安装脚本来运行make,我有一个相应的Makefile下载二进制文件。

npm install同样,当我作为自己的项目运行时,这有效,libsbmlsim但是当它作为依赖项安装时无法安装,即npm install libsbmlsim.

这是我的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

源代码在这里:https ://github.com/stanley-gu/libsbmlsim

4

1 回答 1

1

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)

于 2013-02-14T02:48:48.957 回答