Open snoblenet opened 9 years ago
I haven't tried this use case.
I think the CWD (current working directory) of irb
is /app/bin
.
And casperjs
expects CWD as /app/vendor/casperjs/bin
, which is the default in console call (the path of executable) but not in irb
.
Please try changing CWD in irb
.
Thanks.
I get:
~ $ pwd
/app
~ $ cd vendor/casperjs/bin
~/vendor/casperjs/bin $ casperjs
Can't open '/app/bin/bootstrap.js'
Did I understand you correctly?
Interesting the PhantomJS still works (as does Ruby for that matter) -- it's just a CasperJS fail
Though ideally you'd want your local environment to work in the same way as Heroku. And locally I get:
[1] pry(main)> `vendor/casperjs/bin/casperjs`
bin/rails: No such file or directory - vendor/casperjs/bin/casperjs
=> nil
[2] pry(main)> `casperjs`
=> "CasperJS version 1.1.0-beta3 at /usr/local/Cellar/casperjs/1.1-beta3/libexec, using phantomjs version 1.9.8\nUsage: casperjs [options] script.[js|coffee] [script argument [script argument ...]]\n casperjs [options] test [test path [test path ...]]\n casperjs [options] selftest\n casperjs [options] __selfcommandtest\n\nOptions:\n\n--verbose Prints log messages to the console\n--log-level Sets logging level\n--help Prints this help\n--version Prints out CasperJS version\n--engine=name Use the given engine. Current supported engine: phantomjs and slimerjs\n\nRead the docs http://docs.casperjs.org/\n\nUnsafe JavaScript attempt to access frame with URL about:blank from frame with URL file:///usr/local/Cellar/casperjs/1.1-beta3/libexec/bin/bootstrap.js. Domains, protocols and ports must match.\n\n"
[3] pry(main)>
Ya, that's weird. I see nothing wrong with the setup, at least that's how I setup my local environment.
On Tue, Jun 2, 2015 at 9:39 AM, Steven Noble notifications@github.com wrote:
Though ideally you'd want your local environment to work in the same way as Heroku. And locally I get:
[1] pry(main)>
vendor/casperjs/bin/casperjs
bin/rails: No such file or directory - vendor/casperjs/bin/casperjs => nil [2] pry(main)>casperjs
=> "CasperJS version 1.1.0-beta3 at /usr/local/Cellar/casperjs/1.1-beta3/libexec, using phantomjs version 1.9.8\nUsage: casperjs [options] script.[js|coffee] [script argument [script argument ...]]\n casperjs [options] test [test path [test path ...]]\n casperjs [options] selftest\n casperjs [options] __selfcommandtest\n\nOptions:\n\n--verbose Prints log messages to the console\n--log-level Sets logging level\n--help Prints this help\n--version Prints out CasperJS version\n--engine=name Use the given engine. Current supported engine: phantomjs and slimerjs\n\nRead the docs http://docs.casperjs.org/\n\nUnsafe JavaScript attempt to access frame with URL about:blank from frame with URL file:///usr/local/Cellar/casperjs/1.1-beta3/libexec/bin/bootstrap.js. Domains, protocols and ports must match.\n\n" [3] pry(main)>— Reply to this email directly or view it on GitHub https://github.com/leesei/heroku-buildpack-casperjs/issues/8#issuecomment-107769226 .
Sorry I seem to have lost one of my comments. I now have it working on Heroku as per your advice, but not in the way I use it locally.
On Heroku I now get:
Loading production environment (Rails 4.2.0)
irb(main):001:0> `vendor/casperjs/bin/casperjs`
=> "CasperJS version 1.1.0-beta3 at /app/vendor/casperjs, using phantomjs version 1.9.8\nUsage: casperjs [options] script.[js|coffee] [script argument [script argument ...]]\n casperjs [options] test [test path [test path ...]]\n casperjs [options] selftest\n casperjs [options] __selfcommandtest\n\nOptions:\n\n--verbose Prints log messages to the console\n--log-level Sets logging level\n--help Prints this help\n--version Prints out CasperJS version\n--engine=name Use the given engine. Current supported engine: phantomjs and slimerjs\n\nRead the docs http://docs.casperjs.org/\n\n"
irb(main):002:0>
Great. The gist is to set BOTH phantomjs and casperjs's path to the environment. See casperjs.sh.
On Tue, Jun 2, 2015 at 9:44 AM, Steven Noble notifications@github.com wrote:
Sorry I seem to have lost one of my comments. I now have it working on Heroku as per your advice, but not in the way I use it locally.
On Heroku I now get:
Loading production environment (Rails 4.2.0) irb(main):001:0>
vendor/casperjs/bin/casperjs
=> "CasperJS version 1.1.0-beta3 at /app/vendor/casperjs, using phantomjs version 1.9.8\nUsage: casperjs [options] script.[js|coffee] [script argument [script argument ...]]\n casperjs [options] test [test path [test path ...]]\n casperjs [options] selftest\n casperjs [options] __selfcommandtest\n\nOptions:\n\n--verbose Prints log messages to the console\n--log-level Sets logging level\n--help Prints this help\n--version Prints out CasperJS version\n--engine=name Use the given engine. Current supported engine: phantomjs and slimerjs\n\nRead the docs http://docs.casperjs.org/\n\n" irb(main):002:0>— Reply to this email directly or view it on GitHub https://github.com/leesei/heroku-buildpack-casperjs/issues/8#issuecomment-107769641 .
Added a convenience method to my app to account for CasperJS behaving differently on localhost vs Heroku:
class Casper
def self.run(file, *variable)
base = Rails.env.production? ? "vendor/casperjs/bin/casperjs" : "casperjs"
`#{base} #{file} #{variable}`
end
end
BTW, I think the issue might be something to do with permissions? In that it says it can't open bootstrap.js, not that it can't find bootstrap.js.
Anyway, I haven't closed this because someone else might chime in with a solution, but for now this hack is working for me. Cheers.
I have installed PhantomJS and CasperJS locally on Mac OS X using Homebrew.
In
rails console
, I get:I have tried to replicate this on Heroku using the following
.buildpacks
file:This is enabled by the
multi buildpack
:However, in
heroku run console --app testivate
I get:I have tried:
But to no avail.
Your thoughts?
Thanks.