Heroku上的Node.Js和Socket.IO应用程序

时间:2013-01-14 22:08:40

标签: javascript node.js heroku hiredis

当我尝试在Heroku上部署我的应用程序时出现此错误消息。有什么建议?我可以轻松地在localhost上部署我的应用程序,但它不适用于Heroku。

我的Package.JSON是:

{
    "name":"tryout",
    "version":"0.0.1",
    "private":true,
    "scripts":{
        "start":"node app"
    },
    "dependencies":{
        "express":"3.0.0rc3",
        "jade":"*",
        "passport":">= 0.1.11",
        "passport-local":">= 0.1.3",
        "underscore":">= 1.3.3",
        "socket.io":">= 0.9.6",
        "node-uuid":">= 1.3.3",
        "mongoose":">= 3.0.2",
        "bcrypt":">= 0.7.1"
    },
    "engines": {
        "node": "0.8.x",
        "npm": "1.1.x"
    }
}

PS:我根本不使用hiredis。

输入命令为:git push heroku master

Counting objects: 1731, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (1541/1541), done.
Writing objects: 100% (1731/1731), 7.42 MiB | 400 KiB/s, done.
Total 1731 (delta 192), reused 0 (delta 0)
-----> Removing .DS_Store files
-----> Node.js app detected
-----> Resolving engine versions
       Using Node.js version: 0.8.14
       Using npm version: 1.1.65
-----> Fetching Node.js binaries
-----> Vendoring node into slug
-----> Installing dependencies with npm
       npm WARN package.json socket-app@0.0.1 No README.md file found!
       npm WARN package.json jade@0.27.2 No README.md file found!

       > hiredis@0.1.14 preinstall /tmp/build_37k5gxae7u8vc/node_modules/hiredis
       > make || gmake

       cd deps/hiredis && make static
       make[1]: Entering directory `/tmp/build_37k5gxae7u8vc/node_modules/hiredis/deps/hiredis'
       make[1]: Nothing to be done for `static'.
       make[1]: Leaving directory `/tmp/build_37k5gxae7u8vc/node_modules/hiredis/deps/hiredis'
       node-waf configure build
       Setting srcdir to                        : /tmp/build_37k5gxae7u8vc/node_modules/hiredis 
       Setting blddir to                        : /tmp/build_37k5gxae7u8vc/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-jj2B 
       'configure' finished successfully (0.056s)
       Waf: Entering directory `/Users/USERNAME/Developer/Sites/bla/node_modules/hiredis/build'
       Waf: Leaving directory `/Users/USERNAME/Developer/Sites/bla/node_modules/hiredis/build'
       Traceback (most recent call last):
         File "/tmp/node-node-jj2B/bin/node-waf", line 16, in <module>
           Scripting.prepare(t, os.getcwd(), VERSION, wafdir)
         File "/tmp/node-node-jj2B/bin/../lib/node/wafadmin/Scripting.py", line 145, in prepare
           prepare_impl(t, cwd, ver, wafdir)
         File "/tmp/node-node-jj2B/bin/../lib/node/wafadmin/Scripting.py", line 135, in prepare_impl
           main()
         File "/tmp/node-node-jj2B/bin/../lib/node/wafadmin/Scripting.py", line 188, in main
           fun(ctx)
         File "/tmp/node-node-jj2B/bin/../lib/node/wafadmin/Scripting.py", line 386, in build
           return build_impl(bld)
         File "/tmp/node-node-jj2B/bin/../lib/node/wafadmin/Scripting.py", line 405, in build_impl
           bld.compile()
         File "/tmp/node-node-jj2B/bin/../lib/node/wafadmin/Build.py", line 268, in compile
           os.chdir(self.bldnode.abspath())
       OSError: [Errno 2] No such file or directory: '/Users/USERNAME/Developer/Sites/bla/node_modules/hiredis/build'
       make: *** [all] Error 1
       sh: gmake: not found
       npm ERR! hiredis@0.1.14 preinstall: `make || gmake`
       npm ERR! `sh "-c" "make || gmake"` failed with 127
       npm ERR! 
       npm ERR! Failed at the hiredis@0.1.14 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! System Linux 2.6.32-347-ec2
       npm ERR! command "/tmp/node-node-jj2B/bin/node" "/tmp/node-npm-nN2P/cli.js" "install" "--production"
       npm ERR! cwd /tmp/build_37k5gxae7u8vc
       npm ERR! node -v v0.8.14
       npm ERR! npm -v 1.1.65
       npm ERR! code ELIFECYCLE
       npm ERR! 
       npm ERR! Additional logging details can be found in:
       npm ERR!     /tmp/build_37k5gxae7u8vc/npm-debug.log
       npm ERR! not ok code 0
 !     Failed to install --production dependencies with npm
 !     Heroku push rejected, failed to compile Node.js app

To git@heroku.com:arcane-sea-8207.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:arcane-sea-8207.git'

1 个答案:

答案 0 :(得分:1)

hiredis似乎间接需要express,你有一个发布候选版本,这可能是问题所在。尝试将express更改为:

"express":"3.x"

另外,请确保不将node_modules目录提交到您的git repo 。将其添加到.gitignore