Permission denied error with phantomjs

泄露秘密 提交于 2019-12-11 06:46:11

问题


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.

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'

I checked the permission on /usr/local/Cellar/phantomjs and didn't notice anything unusual. I can run phantomjs without 'sudo'.

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| require f }

ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)

WebMock.disable_net_connect!(:net_http_connect_on_start => true, :allow_localhost => true)

Capybara.javascript_driver = :poltergeist

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.

Thanks for your help


回答1:


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.

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

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!



来源:https://stackoverflow.com/questions/21045997/permission-denied-error-with-phantomjs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!