Heroku将我的sinatra应用程序检测为node.js应用程序并失败

时间:2012-09-05 19:49:17

标签: ruby deployment heroku sinatra

这是我的sinatra应用程序的目录结构

➜  app-fin git:(master) ls
public/  views/  birthday_countdown.rb  config.ru  Gemfile  Gemfile.lock  Procfile  web.rb

我的Gemfile是

source 'https://rubygems.org'

gem 'sinatra'
gem 'thin'

Procfile

web: bundle exec ruby web.rb -p $PORT

和config.ru

$:.unshift File.expand_path("../", __FILE__)
require './web'
run Sinatra::Application

当我尝试推送到heroku时,我收到此错误,

-----> 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
       npm ERR! Couldn't read dependencies.
       npm ERR! Error: Invalid name: "Sinatra Class" may not start with '.' or contain %/@+: or whitespace
       npm ERR!     at /tmp/node-npm-cVE5/lib/utils/read-json.js:229:13
       npm ERR!     at /tmp/node-npm-cVE5/lib/utils/read-json.js:134:32
       npm ERR!     at P (/tmp/node-npm-cVE5/lib/utils/read-json.js:110:40)
       npm ERR!     at cb (/tmp/node-npm-cVE5/node_modules/graceful-fs/graceful-fs.js:36:9)
       npm ERR!     at [object Object].<anonymous> (fs.js:123:5)
       npm ERR!     at [object Object].emit (events.js:64:17)
       npm ERR!     at Object.oncomplete (fs.js:1190:12)
       npm ERR! Report this *entire* log at:
       npm ERR!     <http://github.com/isaacs/npm/issues>
       npm ERR! or email it to:
       npm ERR!     <npm-@googlegroups.com>
       npm ERR! 
       npm ERR! System Linux 2.6.32-346-ec2
       npm ERR! command "/tmp/node-node-yUVv/bin/node" "/tmp/node-npm-cVE5/cli.js" "install" "--production"
       npm ERR! cwd /tmp/build_16s1spp2lcght
       npm ERR! node -v v0.6.20
       npm ERR! npm -v 1.0.106
       npm ERR! 
       npm ERR! Additional logging details can be found in:
       npm ERR!     /tmp/build_16s1spp2lcght/npm-debug.log
       npm not ok
 !     Failed to install --production dependencies with npm
 !     Heroku push rejected, failed to compile Node.js app

我很困惑为什么它认为我的应用程序应该使用node.js,有没有人有任何想法如何说服heroku它实际上是一个sinatra应用程序。

1 个答案:

答案 0 :(得分:0)

您是否有可能在创建应用时指定了node.js buildpack?

https://devcenter.heroku.com/articles/buildpacks

由于你有一个合适的Gemfile,它应该首先被ruby buildpack检测到。此外,由于您没有package.json文件,因此不应检测到Node.js.