本文介绍了将nodej部署到heroku的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经遵循入门指南,将nodejs应用程序部署到heroku:

I've followed the getting started guide to deploy a nodejs application to heroku: https://devcenter.heroku.com/articles/nodejs

它工作正常,直到 git push heroku master 。这将以以下输出终止:

It worked fine until git push heroku master. This terminated with the following output:

git push heroku master
Counting objects: 1018, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (894/894), done.
Writing objects: 100% (1018/1018), 4.03 MiB | 64 KiB/s, done.
Total 1018 (delta 75), reused 0 (delta 0)

-----> Heroku receiving push
-----> Node.js app detected
-----> Resolving engine versions
       Using Node.js version: 0.6.20
       Using npm version: 1.0.106
-----> Fetching Node.js binaries
-----> Vendoring node into slug
-----> Installing dependencies with npm


       > [email protected] install /tmp/build_ngyi26sy7e54/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
       > node install.js

       [ws v0.4.21] Attempting to compile blazing fast native extensions.
       [ws v0.4.21] Native code compile failed (but the module will still work):
       [ws v0.4.21] The native extensions are faster, but not required.
       [ws v0.4.21] On Windows, native extensions require Visual Studio and Python.
       [ws v0.4.21] On Unix, native extensions require Python, make and a C++ compiler.
       [ws v0.4.21] Start npm with --ws:verbose to show compilation output (if any).

       > [email protected] preinstall /tmp/build_ngyi26sy7e54/node_modules/socket.io/node_modules/redis/node_modules/hiredis
       > make || gmake

       cd deps/hiredis && make static
       make[1]: Entering directory `/tmp/build_ngyi26sy7e54/node_modules/socket.io/node_modules/redis/node_modules/hiredis/deps/hiredis'
       make[1]: Nothing to be done for `static'.
       make[1]: Leaving directory `/tmp/build_ngyi26sy7e54/node_modules/socket.io/node_modules/redis/node_modules/hiredis/deps/hiredis'
       node-waf configure build
       Setting srcdir to                        : /tmp/build_ngyi26sy7e54/node_modules/socket.io/node_modules/redis/node_modules/hiredis
       Setting blddir to                        : /tmp/build_ngyi26sy7e54/node_modules/socket.io/node_modules/redis/node_modules/hiredis/build
       Checking for program g++ or c++          : /usr/bin/g++
       Checking for program cpp                 : /usr/bin/cpp
       Checking for program ar                  : /usr/bin/ar
       Checking for program ranlib              : /usr/bin/ranlib
       Checking for g++                         : ok
       Checking for node path                   : not found
       Checking for node prefix                 : ok /tmp/node-node-Wyfk
       'configure' finished successfully (0.029s)
       Waf: Entering directory `/home/lhk/Desktop/zwillenhomepage/node_modules/socket.io/node_modules/redis/node_modules/hiredis/build'
       Waf: Leaving directory `/home/lhk/Desktop/zwillenhomepage/node_modules/socket.io/node_modules/redis/node_modules/hiredis/build'
       Traceback (most recent call last):
         File "/tmp/node-node-Wyfk/bin/node-waf", line 16, in <module>
           Scripting.prepare(t, os.getcwd(), VERSION, wafdir)
         File "/tmp/node-node-Wyfk/bin/../lib/node/wafadmin/Scripting.py", line 145, in prepare
           prepare_impl(t, cwd, ver, wafdir)
         File "/tmp/node-node-Wyfk/bin/../lib/node/wafadmin/Scripting.py", line 135, in prepare_impl
           main()
         File "/tmp/node-node-Wyfk/bin/../lib/node/wafadmin/Scripting.py", line 188, in main
           fun(ctx)
         File "/tmp/node-node-Wyfk/bin/../lib/node/wafadmin/Scripting.py", line 386, in build
           return build_impl(bld)
         File "/tmp/node-node-Wyfk/bin/../lib/node/wafadmin/Scripting.py", line 405, in build_impl
           bld.compile()
         File "/tmp/node-node-Wyfk/bin/../lib/node/wafadmin/Build.py", line 268, in compile
           os.chdir(self.bldnode.abspath())
       OSError: [Errno 2] No such file or directory: '/home/lhk/Desktop/zwillenhomepage/node_modules/socket.io/node_modules/redis/node_modules/hiredis/build'
       make: *** [all] Error 1
       sh: gmake: not found
       npm ERR! [email protected] preinstall: `make || gmake`
       npm ERR! `sh "-c" "make || gmake"` failed with 127
       npm ERR!
       npm ERR! Failed at the [email protected] preinstall script.
       npm ERR! This is most likely a problem with the hiredis package,
       npm ERR! not with npm itself.
       npm ERR! Tell the author that this fails on your system:
       npm ERR!     make || gmake
       npm ERR! You can get their info via:
       npm ERR!     npm owner ls hiredis
       npm ERR! There is likely additional logging output above.
       npm ERR!
       npm ERR! System Linux 2.6.32-343-ec2
       npm ERR! command "/tmp/node-node-Wyfk/bin/node" "/tmp/node-npm-Rq2Y/cli.js" "rebuild"
       npm ERR! cwd /tmp/build_ngyi26sy7e54
       npm ERR! node -v v0.6.20
       npm ERR! npm -v 1.0.106
       npm ERR! code ELIFECYCLE
       npm ERR!
       npm ERR! Additional logging details can be found in:
       npm ERR!     /tmp/build_ngyi26sy7e54/npm-debug.log
       npm not ok
 !     Failed to rebuild dependencies with npm
 !     Heroku push rejected, failed to compile Node.js app

To [email protected]:morning-plateau-9747.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:morning-plateau-9747.git'

我不知道如何解决这个问题。应用程序仍然是准系统。我决定让它在英雄上运行,然后逐步添加我想要的功能。它在localhost上运行良好,npm安装所有的依赖关系,没有错误,并且使用Procfile,它甚至可以与工头一起工作。我已经使用github创建repo并克隆在我的机器上。部署到我的github帐户工作没有问题。以下是回购的链接

I don't know how to fix this. The application is still a barebone. I decided to get it up and running on heroku and then incrementally add the features I wanted. It runs great on localhost, npm installs all the dependencies without an error and with a Procfile it even works with foreman. I've used github to create the repo and cloned it on my machine. Deploying to my github account works without problems. Here's the link to the repo https://github.com/lhk/zwillenhomepage

我可以做什么?

相关的package.json:

Relevant package.json:

{
  "name": "zwillen-webseite",
  "scripts": {
    "start": "server.js"
  },
  "version": "0.0.1",
  "engines": {
    "node": "0.6.x"
  },
  "dependencies": {
    "express": "3.0.x",
    "socket.io": "0.9.8",
    "jade": "0.27.0"
  }
}


推荐答案

基本上是上下文中的hiredis模块正在被socket.io使用。

Basically the hiredis module in context is being used by socket.io.

如果你引用eis'答案中提到的线程,你会发现你们都使用了socket.io 0.9。 8。

If you refer to the thread mentioned in eis' answer, you'd see that both of you are using socket.io 0.9.8.

尝试使用0.9.6(我使用它在heroku上,从未有过这样的问题)。

Try using 0.9.6 (I use it on heroku and have never had such problems).

这篇关于将nodej部署到heroku的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 07:08