invalid byte sequence in US-ASCII during assets:precompile - ruby-on-rails-3

I can no longer deploy my app because of an UTF error, here is the trace :
/srv/outils/www/railsapp/releases/20140414151455$ cd -- /srv/outils/www/railsapp/releases/20140414151455 && RAILS_ENV=prodtest RAILS_GROUPS=assets bundle exec rake assets:precompile --trace
rake aborted!
rake aborted!
invalid byte sequence in US-ASCII
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/trace_output.rb:16:in `block in trace_on'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/trace_output.rb:14:in `map'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/trace_output.rb:14:in `trace_on'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:340:in `trace'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:187:in `display_error_message'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:174:in `rescue in standard_exception_handling'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:93:in `load_rakefile'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:77:in `block in run'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/bin/rake:23:in `load'
/srv/outils/www/railsapp/shared/bundle/ruby/1.9.1/bin/rake:23:in `<main>'
The LANG variable is set to fr_FR.UTF-8.
What bother me is that which ruby gives me :
/home/admin/.rvm/rubies/ruby-1.9.3-p286/bin/ruby
I installed a rvm gem and now i have exactly the same error with the correct RVM path.
I tried :
Adding #encoding UTF-8 everywhere
Added :
if RUBY_VERSION =~ /1.9/
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
end
Checked $LANG on my server
Removed any éè etc.. from my previous commits
EDIT : Migrated from ruby 1.9.3 to 2.1
Where to go now to investigate this problem?

Related

Impossible to use rake in my rails project

Every time I try to use rake in my rails project it throw me the message below. I tried to re-install ruby, rails, rake, re-create the project, launch my rake db:migrate with sudo but nothing seems to work...
I created the object via the scaffold command:
rails generate scaffold User nom:string email:string
After this command execute succesfully, i launch
rake db:migrate
And it return this message:
rake aborted!
GONE
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/tasks/documentation.rake:1:in `require'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/tasks/documentation.rake:1:in `<top (required)>'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/tasks.rb:15:in `load'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/tasks.rb:15:in `block in <top (required)>'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/tasks.rb:6:in `each'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/tasks.rb:6:in `<top (required)>'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/application.rb:213:in `require'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/application.rb:213:in `initialize_tasks'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/application.rb:139:in `load_tasks'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/application.rb:77:in `method_missing'
/home/bassochette/Dev/rails/tuto/demo_app/Rakefile:7:in `<top (required)>'
(See full trace by running task with --trace)
ps: I'm new to rails and in the learning phase.

rake aborted! invalid byte sequence in UTF-8, Rails 3, ruby 1.9.3, Ubuntu 12.04 LTS, updated recently

Here is the stack trace,
$ bundle exec rake --trace
rake aborted!
invalid byte sequence in UTF-8
/home/gautam/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:183:in `glob'
/home/gautam/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:183:in `block in have_rakefile'
/home/gautam/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:181:in `each'
/home/gautam/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:181:in `have_rakefile'
/home/gautam/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:468:in `find_rakefile_location'
/home/gautam/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:486:in `raw_load_rakefile'
/home/gautam/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block in load_rakefile'
/home/gautam/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/gautam/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/home/gautam/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block in run'
/home/gautam/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/gautam/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/home/gautam/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/home/gautam/.rvm/gems/ruby-1.9.3-p194#global/bin/rake:19:in `load'
/home/gautam/.rvm/gems/ruby-1.9.3-p194#global/bin/rake:19:in `<main>'
/home/gautam/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
/home/gautam/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'
Anyone got a clue why this is happening? I updated my Ubuntu 12.04 LTS some days back and this started happening.
So far I have tried reinstall rvm and gemsets, reinstalling Postgresql and installed node.js locally so that execjs finds it.

rails server in debug mode

When I try to run rails server in debugger mode using "rails server --debugger". I am getting the following error on my console.
/home/navyug/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/ext/module.rb:36:in `const_missing': uninitialized constant Debugger::LocalInterface::Readline (NameError)
from /home/navyug/.rvm/gems/ruby-1.9.3-p194/gems/ruby-debug19-0.11.6/cli/ruby-debug/interface.rb:55:in `block (2 levels) in initialize'
from /home/navyug/.rvm/gems/ruby-1.9.3-p194/gems/ruby-debug19-0.11.6/cli/ruby-debug/interface.rb:53:in `each'
from /home/navyug/.rvm/gems/ruby-1.9.3-p194/gems/ruby-debug19-0.11.6/cli/ruby-debug/interface.rb:53:in `block in initialize'
from /home/navyug/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/open-uri.rb:35:in `open'
from /home/navyug/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/open-uri.rb:35:in `open'
from /home/navyug/.rvm/gems/ruby-1.9.3-p194/gems/ruby-debug19-0.11.6/cli/ruby-debug/interface.rb:52:in `initialize'
from /home/navyug/.rvm/gems/ruby-1.9.3-p194/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:61:in `new'
from /home/navyug/.rvm/gems/ruby-1.9.3-p194/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:61:in `initialize'
from /home/navyug/.rvm/gems/ruby-1.9.3-p194/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:9:in `new'
from /home/navyug/.rvm/gems/ruby-1.9.3-p194/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:9:in `<module:Debugger>'
from /home/navyug/.rvm/gems/ruby-1.9.3-p194/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:8:in `<top (required)>'
from /home/navyug/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.7/lib/rails/rack/debugger.rb:9:in `initialize'
from /home/navyug/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/server.rb:295:in `new'
from /home/navyug/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/server.rb:295:in `block in build_app'
from /home/navyug/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/server.rb:291:in `reverse_each'
from /home/navyug/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/server.rb:291:in `build_app'
from /home/navyug/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
from /home/navyug/.rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
from /home/navyug/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.7/lib/rails/commands/server.rb:70:in `start'
from /home/navyug/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.7/lib/rails/commands.rb:55:in `block in <top (required)>'
from /home/navyug/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.7/lib/rails/commands.rb:50:in `tap'
from /home/navyug/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.7/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
RubyGems Environment
RUBYGEMS VERSION: 1.8.24
RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [i686-linux]
INSTALLATION DIRECTORY: /home/navyug/.rvm/gems/ruby-1.9.3-p194
RUBY EXECUTABLE: /home/navyug/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
EXECUTABLE DIRECTORY: /home/navyug/.rvm/gems/ruby-1.9.3-p194/bin
RUBYGEMS PLATFORMS:
ruby
x86-linux
GEM PATHS:
/home/navyug/.rvm/gems/ruby-1.9.3-p194
/home/navyug/.rvm/gems/ruby-1.9.3-p194#global
GEM CONFIGURATION:
:update_sources => true
:verbose => true
:benchmark => false
:backtrace => false
:bulk_threshold => 1000
REMOTE SOURCES:
http://rubygems.org/
I think the Readline package is missing in your setup. Since you are using RVM, try and install the readline package via rvm. These links might be helpful:
Previous similar SO question related to readline problem
Fixing Readline for the Ruby on Rails console
RVM package: Readline

no such file to load -- /app/config/application

I have a rails app which I've pushed to heroku GIT repo, every thing is fine, until I try to migrate data bases, here is what I get:
sam#ubuntu:~/RubymineProjects/dcaclab$ heroku run rake db:migrate --trace
Running `rake db:migrate --trace` attached to terminal... up, run.1
rake aborted!
no such file to load -- /app/config/application
/app/Rakefile:5:in `require'
/app/Rakefile:5:in `<top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block in load_rakefile'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block in run'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/app/vendor/bundle/ruby/1.9.1/bin/rake:19:in `load'
/app/vendor/bundle/ruby/1.9.1/bin/rake:19:in `<main>'
Any idea please ?
I ran into the same issue and figured it out - I'd accidentally added my config folder to my .gitignore, so it wasn't pushed to Heroku.

Ruby on Rails Tutorial Demo_App - rake db:migrate to Heroku not working

I'm doing Michael Hartl's Rails Tutorials and am having a bit of a problem with the final stage of the Demo App, that is, running the rake command on Heroku to migrate the database to the web.
The rake command with a --trace on it gives the following result:
$ heroku run rake db:migrate --trace
Running `rake db:migrate --trace` attached to terminal...
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36: command not found: tput cols
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36: command not found: tput lines
up, run.1
(in /app)
* Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
no such file to load -- pg
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:239:in `require'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:239:in `block in require'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:227:in `load_dependency'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:239:in `require'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:9:in `postgresql_connection'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:230:in `new_connection'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:238:in `checkout_new_connection'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:194:in `block (2 levels) in checkout'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:190:in `loop'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:190:in `block in checkout'
/usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:189:in `checkout'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:96:in `connection'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:318:in `retrieve_connection'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:97:in `retrieve_connection'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:89:in `connection'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/migration.rb:486:in `initialize'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/migration.rb:433:in `new'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/migration.rb:433:in `up'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/migration.rb:415:in `migrate'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.0.1/lib/active_record/railties/databases.rake:142:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/bin/rake:31:in `<top (required)>'
/app/vendor/bundle/ruby/1.9.1/bin/rake:19:in `load'
/app/vendor/bundle/ruby/1.9.1/bin/rake:19:in `<main>'
I thought that that 'command not found: tput' stuff at the start might have been down to something I modified (it looks like the word 'output' that got cut off) so I redid the entire chapter from the beginning, but ended up with the same result, so I don't think it's any changes I made to the code.
I'm using a Windows PC, running XP. Everything worked fine when run on the localhost and my Git Repository pushed to Heroku perfectly, so everything works except for this rake command. If ye want to see any of the other files, they're at: https://github.com/jimbobsweeney/demo_app
I'm very grateful in advance for any help on this. It's melting my brain.
Rob
Do you have Cygwin installed? This article (in Japanese) mentions this error and points to this SO question which suggests you make sure Cygwin and possibly ncurses is installed. A comment there links to this article which may also have useful information.
It looks like the issue is that heroku is looking for the tput command in your shell which is not available (which I believe comes with ncurses).
As for the stack trace, it looks like the pg gem is not in your Gemfile in a place the production environment will execute it. It's not necessary to install pg on Windows just to get the deploy working. Create a :production group in your Gemfile for this.
group :production do
gem "pg", "~> 0.11.0"
end
You can learn more about groups in the bundler docs.