权限被拒绝的错误与phantomjs [英] Permission denied error with phantomjs
问题描述
我在Ruby 2.0.0-p353和OSX Mavericks上使用Rails 4.0.2,Guard 2.2.4,guard-rspec 4.2.4,rspec-rails 2.14.0,Capybara 2.2.1和Poltergeist 1.5.0.
I am using Rails 4.0.2, Guard 2.2.4, guard-rspec 4.2.4, rspec-rails 2.14.0, Capybara 2.2.1 and Poltergeist 1.5.0 on Ruby 2.0.0-p353 and OSX Mavericks.
当我运行bundle execguard时,出现以下错误消息,但失败很多: 后钩中发生错误 Errno :: EACCES:权限被拒绝-/usr/local/Cellar/phantomjs 发生在/Users/gillesmath/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/open3.rb:211:在'spawn'中
When I run bundle exec guard I got a lot of failure with this error message : An error occurred in an after hook Errno::EACCES: Permission denied - /usr/local/Cellar/phantomjs occurred at /Users/gillesmath/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/open3.rb:211:in `spawn'
我检查了/usr/local/Cellar/phantomjs的权限,没有发现任何异常.我可以在不带"sudo"的情况下运行phantomjs.
I checked the permission on /usr/local/Cellar/phantomjs and didn't notice anything unusual. I can run phantomjs without 'sudo'.
我的spec_helper文件如下所示: ENV ["RAILS_ENV"] || ='测试' 需要File.expand_path("../../config/environment",文件) 需要'rspec/rails' 需要'rspec/autorun' 需要"capybara/rspec" 需要'webmock/rspec' 需要水豚/poltergeist"
My spec_helper file look like this : ENV["RAILS_ENV"] ||= 'test' require File.expand_path("../../config/environment", FILE) require 'rspec/rails' require 'rspec/autorun' require "capybara/rspec" require 'webmock/rspec' require 'capybara/poltergeist'
Dir [Rails.root.join("spec/support/* / .rb")].each {| f |要求f}
Dir[Rails.root.join("spec/support/*/.rb")].each { |f| require f }
ActiveRecord :: Migration.check_pending! (ActiveRecord :: Migration)
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
WebMock.disable_net_connect!(:net_http_connect_on_start => true,:allow_localhost => true)
WebMock.disable_net_connect!(:net_http_connect_on_start => true, :allow_localhost => true)
Capybara.javascript_driver =:poltergeist
Capybara.javascript_driver = :poltergeist
我看不到出什么问题了,因为rails应用程序和/usr/local/Cellar/phantomjs目录及其内容的owner:group是相同的.
I can't see what is wrong because the owner:group is the same for both the rails app and the /usr/local/Cellar/phantomjs dir and its content.
感谢您的帮助
推荐答案
该错误使它看起来像试图执行/usr/local/Cellar/phantomjs
目录而不是其中的可执行文件.我认为Poltergeist会扫描您的PATH
以查找称为phantomjs
的第一件事. /usr/local/Cellar
在您的PATH
中吗?
That error makes it look like it's trying to execute the /usr/local/Cellar/phantomjs
directory instead of the executable inside it. I think Poltergeist scans your PATH
for the first thing called phantomjs
. Is /usr/local/Cellar
in your PATH
?
如果是这样,我建议将其取出,因为可执行文件永远不应直接出现在其中.
If so, I'd recommend taking it out, since executables should never appear in there directly.
如果不能,另一种选择是在设置代码中为Poltergeist配置指向phantomjs
的显式路径:
If you can't, another option is to configure Poltergeist with an explicit path to phantomjs
in your setup code: https://github.com/jonleighton/poltergeist#customization
似乎有人已经打开了一个拉动请求,并提供了跳过目录的修补程序在Poltergeist使用的 Cliver 宝石中,因此希望该问题很快得到解决!
It looks like someone has already opened a pull request with a fix to skip directories in the Cliver gem that Poltergeist uses, so hopefully that will be fixed soon!
这篇关于权限被拒绝的错误与phantomjs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!