2

这是我的 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'

过程文件

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 应用程序。

4

1 回答 1

0

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

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

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

于 2012-09-06T00:22:41.647 回答