自几周前Dreamhost升级服务器以来,我的网站已被破坏。我一直在试图弄清楚我的头发并试图取得一些进展,但我仍然坚持希望最后的问题。
我在Ruby 1.8.7上使用Rails 3.1.1,并从PhusionPassenger获得一个'Ruby(Rack)应用程序无法启动错误'。它声明它'找不到JavaScript运行时。有关可用运行时的列表,请参阅https://github.com/sstephenson/execjs。 (ExecJS :: RuntimeUnavailable)”。在Dreamhost的维基上搜索这个已经建议安装'therubyracer'宝石的解决方案。
所以我使用建议的gem更新了我的gemfile,如下所示:
gem'therubyracer','〜> 0.9.9'
编辑:我还尝试使用以下方法添加到文件中:
gem'therubyracer',: platforms => :红宝石
但它并没有什么不同。
然后捆绑安装在我的Macbook(运行OS X 10.5.8)上,没有任何障碍。但是,当我运行'cap deploy'来放置Dreamhost时,这会失败;我在尝试安装therubyracer依赖的libv8时看到错误。
任何人都知道如何正确安装或任何其他有效的解决方案?
可根据要求提供任何其他信息。
来自终端的完整错误反馈:
- 执行“cd /home/futureproof/abunchofletters.co.uk/releases/20111118003703&& bundle install --gemfile /home/futureproof/abunchofletters.co.uk/releases/20111118003703/Gemfile --path /home/futureproof/.gems/bundle --demployment --quiet - withoutout development test“ 服务器:[“abunchofletters.co.uk”] [abunchofletters.co.uk]执行命令** [out :: abunchofletters.co.uk]不幸的是,发生了致命错误。 请将此错误报告给Bundler问题跟踪器 https://github.com/carlhuda/bundler/issues以便我们可以修复它。 谢谢! ** [out :: abunchofletters.co.uk] /usr/lib/ruby/1.8/rubygems/installer.rb:483:in
build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError) ** [out :: abunchofletters.co.uk] ** [out :: abunchofletters.co.uk] /usr/bin/ruby1.8 extconf.rb ** [out :: abunchofletters.co.uk] *** extconf.rb failed *** ** [out :: abunchofletters.co.uk] Could not create Makefile due to some reason, probably lack of ** [out :: abunchofletters.co.uk] necessary libraries and/or headers. Check the mkmf.log file for more ** [out :: abunchofletters.co.uk] details. You may need configuration options. ** [out :: abunchofletters.co.uk] ** [out :: abunchofletters.co.uk] Provided configuration options: ** [out :: abunchofletters.co.uk] --with-opt-dir ** [out :: abunchofletters.co.uk] --without-opt-dir ** [out :: abunchofletters.co.uk] --with-opt-include ** [out :: abunchofletters.co.uk] --without-opt-include=${opt-dir}/include ** [out :: abunchofletters.co.uk] --with-opt-lib ** [out :: abunchofletters.co.uk] --without-opt-lib=${opt-dir}/lib ** [out :: abunchofletters.co.uk] --with-make-prog ** [out :: abunchofletters.co.uk] --without-make-prog ** [out :: abunchofletters.co.uk] --srcdir=. ** [out :: abunchofletters.co.uk] --curdir ** [out :: abunchofletters.co.uk] --ruby=/usr/bin/ruby1.8 ** [out :: abunchofletters.co.uk] extconf.rb:13: uninitialized constant Gem (NameError) ** [out :: abunchofletters.co.uk] Checking for Python... ** [out :: abunchofletters.co.uk] ** [out :: abunchofletters.co.uk] Gem files will remain installed in /home/futureproof/.gems/bundle/ruby/1.8/gems/libv8-3.3.10.4 for inspection. ** [out :: abunchofletters.co.uk] Results logged to /home/futureproof/.gems/bundle/ruby/1.8/gems/libv8-3.3.10.4/ext/libv8/gem_make.out ** [out :: abunchofletters.co.uk] from /usr/lib/ruby/1.8/rubygems/installer.rb:446:in
每个'** [out :: abunchofletters.co.uk]来自 /usr/lib/ruby/1.8/rubygems/installer.rb:446:inbuild_extensions' ** [out :: abunchofletters.co.uk] from /usr/lib/ruby/1.8/rubygems/installer.rb:198:in
安装'** [out :: abunchofletters.co.uk]来自 /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/source.rb:90:in 来自install' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/rubygems_integration.rb:78:in
preserve_paths'** [out :: abunchofletters.co.uk] /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/source.rb:89:in 来自install' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/installer.rb:73:in
install_gem_from_spec'** [out :: abunchofletters.co.uk] /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/rubygems_integration.rb:93:in 来自with_build_args' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/installer.rb:72:in
install_gem_from_spec'** [out :: abunchofletters.co.uk] /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/installer.rb:56:inrun' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/installer.rb:55:in
运行'** [out :: abunchofletters.co.uk] /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/installer.rb:12:ininstall' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/cli.rb:219:in
安装'** [out :: abunchofletters.co.uk]来自 /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/vendor/thor/task.rb:22:insend' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/vendor/thor/task.rb:22:in
运行'** [out :: abunchofletters.co.uk] /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/vendor/thor/invocation.rb:118:ininvoke_task' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/vendor/thor.rb:263:in
发送'** [out :: abunchofletters.co.uk]来自 /home/futureproof/.gems/gems/bundler-1.1.rc/lib/bundler/vendor/thor/base.rb:386:instart' ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/gems/bundler-1.1.rc/bin/bundle:13 ** [out :: abunchofletters.co.uk] from /home/futureproof/.gems/bin/bundle:19:in
加载'** [out :: abunchofletters.co.uk]来自 /home/futureproof/.gems/bin/bundle:19 命令在13170ms完成 *** [deploy:update_code]回滚*执行“rm -rf /home/futureproof/abunchofletters.co.uk/releases/20111118003703; true” 服务器:[“abunchofletters.co.uk”] [abunchofletters.co.uk]执行命令 命令在563ms完成失败:“sh -c'cd /home/futureproof/abunchofletters.co.uk/releases/20111118003703& amp;& bundle install --gemfile /home/futureproof/abunchofletters.co.uk/releases/20111118003703/Gemfile --path /home/futureproof/.gems/bundle --demployment --quiet - without development test'“on abunchofletters.co.uk
答案 0 :(得分:128)
如果您使用的是Ubuntu,请安装nodejs
sudo apt-get install nodejs
答案 1 :(得分:33)
libv8
是一个OS库;您需要安装正确的Linux系统库。如果您正在运行Ubuntu,那就是
sudo apt-get install libv8-dev
或者,您可以安装node.js
作为各种发行版的Debian / Ubuntu软件包,例如http://ppa.launchpad.net/chris-lea/node.js/ubuntu
您可以通过在Heroku上部署来节省很多麻烦,而无需管理操作系统或宝石组件。
答案 2 :(得分:10)
我在Dreamhost上使用这个宝石,使用Rails 3.1作为资产管道
group :assets do
gem 'execjs'
gem 'therubyracer', :platforms => :ruby
gem 'johnson'
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
end
therubyracer作为预编译器,johnson作为运行时。
这项工作适用于Dreamhost托管的2个Rails 3.1应用程序。
答案 3 :(得分:5)
我在dreamhost共享服务器上。
我在不使用root / sudo的情况下安装了nodejs。在服务器上:
#download node js (check last version from web)
$ wget http://nodejs.org/dist/v0.8.16/node-v0.8.16-linux-x86.tar.gz
#untar
$ tar xzf node-v0.8.16-linux-x86.tar.gz
Finnaly将其路径添加到deploy.rb,添加以下行(在这种情况下添加了一些路径):
default_environment["PATH"] = ":/home/myUser/soft/node-v0.8.16-linux-x86/bin:/home/myUser/.gems/bin:/usr/lib/ruby/gems/1.8/bin/:$PATH"
你已经完成了
答案 4 :(得分:4)
对于带有Brew的操作系统,您只需要获取if (task.isSuccessful()) {
Log.d("myTag","Review can be requested");
reviewInfo = task.getResult();
}
:
libv8
答案 5 :(得分:1)
我只是看到了关于此的演示文稿。
到目前为止,我一直使用rubytheracer。显然它不是那么好。这是巨大的。
但你可以使用任何javascript运行时。
另外两个推荐的是execjs和node.js(现在非常热门)。
确保gem install
所选的宝石,然后bundle install
或bundle update
为您的应用。
另一个注意事项是你也应该切换到1.9.2 安装RVM(bash<<(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)) 你可以同时拥有1.8.7和1.9.2。
答案 6 :(得分:1)
我刚刚在Win7开发机器上遇到了同样的问题。看起来安装https://github.com/hiranpeiris/therubyracer_for_windows并将gem 'therubyracer'
添加到Gemfile
进行排序。
在:
$ rails generate
c:/Ruby193/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
from c:/Ruby193/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs.rb:5:in `<module:ExecJS>'
(...)
这基本上意味着Rails需要rubyracer
和libv8
。
后:
$ rails generate
SECURITY WARNING: No secret option provided to Rack::Session::Cookie.
This poses a security threat. It is strongly recommended that you
provide a secret to prevent exploits that may be possible from crafted
cookies. This will not be supported in future versions of Rack, and
future versions will even invalidate your existing user cookies.
Called from: c:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/session/abstract_store.rb:28:in `initialize'.
Usage: rails generate GENERATOR [args] [options]
(...)
答案 7 :(得分:0)
我建议安装 Nodejs 。它对我有用。
只需前往您的终端并输入:
sudo apt-get install node.js
输入您的密码...并在要求确认时按'Y'。我希望这有帮助!!!
答案 8 :(得分:0)
在Gemfile中添加以下gem并尝试使用bundle install
gem“therubyracer”,“〜&gt; 0.10.2”