2017-07-31 16 views
0

rails runnerを使用して実行するスクリプトを作成しました。私はそれをローカルにテストし、それがうまく働いたが、リモートサーバー上で(それがAWSに展開です)、それは次のようなエラーがスローされます。ここ構文テスト環境でレールランナーを実行しようとするとエラーが発生します

/home/ubuntu/my-project/vendor/bundle/ruby/2.1.0/gems/railties-4.1.14.1 
/lib/rails/commands/runner.rb:62: 
syntax error, unexpected tIDENTIFIER, expecting end-of-input 

完全なエラーメッセージ:

/home/ubuntu/my-project/vendor/bundle/ruby/2.1.0/gems/railties-4.1.14.1/lib/rails/commands/runner.rb:62:in `eval': /home/ubuntu/my-project/vendor/bundle/ruby/2.1.0/gems/railties-4.1.14.1/lib/rails/commands/runner.rb:62: unknown regexp options - rt (SyntaxError) 
/home/ubuntu/my-project/vendor/bundle/ruby/2.1.0/gems/railties-4.1.14.1/lib/rails/commands/runner.rb:62: syntax error, unexpected tIDENTIFIER, expecting end-of-input 
/script/content_update.rb 
          ^
    from /home/ubuntu/my-project/vendor/bundle/ruby/2.1.0/gems/railties-4.1.14.1/lib/rails/commands/runner.rb:62:in `<top (required)>' 
    from /home/ubuntu/my-project/vendor/bundle/ruby/2.1.0/gems/railties-4.1.14.1/lib/rails/commands/commands_tasks.rb:128:in `require' 
    from /home/ubuntu/my-project/vendor/bundle/ruby/2.1.0/gems/railties-4.1.14.1/lib/rails/commands/commands_tasks.rb:128:in `require_command!' 
    from /home/ubuntu/my-project/vendor/bundle/ruby/2.1.0/gems/railties-4.1.14.1/lib/rails/commands/commands_tasks.rb:95:in `runner' 
    from /home/ubuntu/my-project/vendor/bundle/ruby/2.1.0/gems/railties-4.1.14.1/lib/rails/commands/commands_tasks.rb:40:in `run_command!' 
    from /home/ubuntu/my-project/vendor/bundle/ruby/2.1.0/gems/railties-4.1.14.1/lib/rails/commands.rb:17:in `<top (required)>' 
    from bin/rails:4:in `require' 
    from bin/rails:4:in `<main>' 

任意のアイデア問題はありますか?

答えて

0

あなたは、このようなコマンドを実行する必要があります:script/content_update.rbはスクリプトへの正しいパスである

rails runner script/content_update.rb 

/script/content_update.rbのように指定した場合、Railsは間違った場所で検索して検索できません。ファイルが見つからない場合、Railsは文字列をRubyスクリプトとして扱い、実行しようとします。そして、この奇妙な例外が発生します。

関連する問題