0

当我尝试部署我的 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”和“make clean”中失败,因为找不到命令“scons”。我在我的应用程序的 node_modules 目录中安装了 libxmljs,并且“scons”位于“/usr/local/bin/scons”。

我相信我必须确保 scons 的位置在 libxmljs 的 make 环境的路径中,但我不知道该怎么做。任何帮助,将不胜感激!

更新:根据这个问题的建议(无法将 node.js 应用程序部署到 heroku),我将 libxmljs 添加到 package.json 中的依赖项并将 node_modules/ 添加到 .gitignore,这样 heroku 可以查看依赖项并安装它们本身。但是,发生了完全相同的错误,这让我相信问题的根源不在于我的本地环境,而是关于 libxmljs 的更大问题?

4

1 回答 1

0

我能够解决我的问题,尽管它并不是专门针对 libxmljs。我还在我的应用程序中使用了“twilio”节点子模块,但在依赖项中将其版本列为“0.0.0”。我猜 twilio 0.0.0 使用了在部署到 heroku 时不会安装的 libxmljs,所以我将 twilio 版本号更新为实际的当前版本,一切顺利!

于 2015-02-13T00:51:15.990 回答