Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 3.1 Rails 3.1使用白化宝石和红地毯时与posix_spawnp相关的错误_Ruby On Rails 3.1_Osx Server - Fatal编程技术网

Ruby on rails 3.1 Rails 3.1使用白化宝石和红地毯时与posix_spawnp相关的错误

Ruby on rails 3.1 Rails 3.1使用白化宝石和红地毯时与posix_spawnp相关的错误,ruby-on-rails-3.1,osx-server,Ruby On Rails 3.1,Osx Server,我关注了Railscasts的一集,内容是使用红地毯、白化病和Pygments向应用程序添加代码高亮显示。它在开发过程中如预期那样工作。但是,在我的测试生产服务器上,我收到以下错误: ActionView::Template::Error (No such file or directory - posix_spawnp): 13: <div class="small_meta"> 14: Posted on <%= @article.c

我关注了Railscasts的一集,内容是使用红地毯、白化病和Pygments向应用程序添加代码高亮显示。它在开发过程中如预期那样工作。但是,在我的测试生产服务器上,我收到以下错误:

ActionView::Template::Error (No such file or directory - posix_spawnp):
13:         <div class="small_meta">
14:             Posted on <%= @article.created_at %> by <%= @article.user.full_name %>. Topics: <%= @article.topic_list %>
15:         </div>
16:         <%= markdown(@article.body) %>
17:     </div>
18: 
19: <% else %>
app/helpers/application_helper.rb:19:in `block in syntax_highlighter'
app/helpers/application_helper.rb:18:in `syntax_highlighter'
app/helpers/application_helper.rb:13:in `markdown'
app/views/home/index.html.erb:16:in `_app_views_home_index_html_erb___3638324493742336500_70112578553660'
问题在于打电话给白化病患者。我不知道如何解决这个问题。似乎白化病患者无法产生
pygmentize
过程。当我在Terminal.app中运行
哪个pygmentize
时,我看到
/usr/local/bin/pygmentize
<代码>/usr/local/bin在我运行
echo$PATH
时出现在我的路径中。测试生产服务器是OS X 10.7服务器上的Apache/Phusion Passenger


这里发生了什么以及如何修复
posix\u spawnp
错误?

我得到了相同的错误,并通过安装pygmentize修复了它。确保已将pygmentize安装到正确的Python解释器中。我正在运行OSX10.7,我有4个不同的python解释器!您可以通过键入

python——版本


还要检查所有相关目录的读/写权限,即“/Library/Python/2.7/site packages”

,例如在macports上,如果您使用的是Python 2.7,
sudo port安装py27 pygments
ln-s/opt/local/bin/pygmentize-2.7~/bin/pygmentize
def markdown(text)
  options = [:hard_wrap, :filter_html, :autolink, :no_intraemphasis, :fenced_code, :gh_blockcode]
  syntax_highlighter(Redcarpet.new(text, *options).to_html).html_safe
end

def syntax_highlighter(html)
    doc = Nokogiri::HTML(html)
    doc.search("//pre[@lang]").each do |pre|
      pre.replace Albino.colorize(pre.text.rstrip, pre[:lang])
    end
    doc.to_s
end