当我尝试部署我的node.js应用程序(同时使用nodejitsu和heroku)时,我遇到了与libxmljs相同的错误。
> libxmljs@0.4.1 preinstall /root/tmp/tmp-31613c7bs0y8/build/package/node_modules/twilio/node_modules/libxmljs
> make node
make: scons: Command not found
make: *** [node] Error 127
npm http 200 https://registry.nodejitsu.com/css-stringify
npm http 200 https://registry.nodejitsu.com/css-parse
npm http 200 https://registry.nodejitsu.com/is-promise/-/is-promise-1.0.1.tgz
> libxmljs@0.4.1 preuninstall /root/tmp/tmp-31613c7bs0y8/build/package/node_modules/twilio/node_modules/libxmljs
> make clean
make: scons: Command not found
make: *** [clean] Error 127
npm http GET https://registry.nodejitsu.com/css-stringify/-/css-stringify-1.0.5.tgz
npm http GET https://registry.nodejitsu.com/css-parse/-/css-parse-1.0.4.tgz
npm WARN continuing anyway libxmljs@0.4.1 preuninstall: `make clean`
npm WARN continuing anyway Exit status 2
npm ERR! libxmljs@0.4.1 preinstall: `make node`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the libxmljs@0.4.1 preinstall script.
npm ERR! This is most likely a problem with the libxmljs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! make node
npm ERR! You can get their info via:
npm ERR! npm owner ls libxmljs
npm ERR! There is likely additional logging output above.
npm ERR! System SunOS 5.11
npm ERR! command "node" "/opt/local/bin/npm" "install" "--loglevel=http"
npm ERR! cwd /root/tmp/tmp-31613c7bs0y8/build/package
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.14
npm ERR! code ELIFECYCLE
正如您所看到的,它在libxmljs' make node'中失败了。并且'做干净'作为命令' scons'找不到。我在我的应用程序的node_modules目录中安装了libxmljs,并且' scons'位于" / usr / local / bin / scons"。
我相信我必须确保scons的位置在libxmljs的make环境的路径中,但我不知道如何做到这一点。任何帮助将不胜感激!
更新:按照这个问题的建议(Fail to deploy node.js application to heroku),我将libxmljs添加到package.json中的依赖项中,并将node_modules /添加到.gitignore,这样heroku可以查看依赖项并自行安装它们。但是,发生了完全相同的错误,这让我相信问题的根源不在于我的本地环境,而是关于libxmljs的更大的东西?
答案 0 :(得分:0)
我能够解决我的问题,虽然它并不是特别关于libxmljs。我还在我的应用程序中使用了'twilio'节点子模块,但在依赖项中将其版本列为'0.0.0'。我猜twilio 0.0.0使用的libxmljs在部署到heroku时不会安装,所以我将twilio版本号更新为实际的当前版本,一切都很好!