简体   繁体   中英

Rails (Puma server) Phantomjs don't run on production

I want to run PhantomJs on Controller.

in my file test.js

use 'strict';
console.log('HELLO WORLD');

in my_controller.rb

def test
  rs = `phantomjs 'path/to/test.js' `
  puts rs
end

When i run project on local in mode development ,

  • i go to action /test => it display 'HELLO WORLD' ( work )

But when i deploy, and run it on mode production It not display HELLO WORLD , seem like phantom js don't run.

I use Phantomjs 2.1.1, rails 5.1.5, ruby 2.3.5 and boot use Puma server. Anyone can show me a way can fix it.

try to make sure phantomjs is installed on your prod server, and the path setting is proper. run phantomjs from your shell to verify this

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM