rake assets:precompile RAILS_ENV=production Error
In local computer you are trying to run
rake assets:precompile RAILS_ENV=production
but this requires your local compute to have config/database.yml with the config mentioned by @thieu-nguyen
so add the following in
username: $PRODUCTION_DB_USER
password: $PRODUCTION_DB_PASS
under production in config/database.yml
then add the environment for you local computer as
PRODUCTION_DB_USER=anzels
PRODUCTION_DB_PASS=1234
and for heroku as
PRODUCTION_DB_USER=user
PRODUCTION_DB_PASS="" (empty)
ANOTHER EASIER WAY IS
username: anzels
password: 1234
to production in config/database.yml **JUST BEFORE assests precompilation **
then run command
git checkout config/database.yml
JUST BEFORE GIT COMMIT command
the idea is to not to commit the username and password but temporarily edit it for assests precompilation purpose only
Another Ruby on Rails Rake assets:precompile error
Thanks to @Les Nightingill, I found the issue.
It was not directly linked to assets generation, but the probleme was indicated at the first error line in the logs :
global-2.0.0/lib/global/base.rb:16:in `configuration'
After a bundle update, the Global gem was updated to the 2.0, and the configuration syntax has changed.
Correcting this make all works well.
Rails: Production assets:precompile error
This is the answer I found, wishing it to be useful for others, too.
To solve the DEPRECATION WARNING, update your gems as expressed by:
Asset pipeline DEPRECATION WARNING tsort.rb:226
And about the main error, you should find which file causes the error exactly. The error output and mentioned files in it are misleading and not necessarily contain syntax error.
You can work with your assets.rb
file to find which file (files) contains syntax error. Comment or remove all of the referred files in assets.rb
except one, redo asset precompile command in your production mode:
RAILS_ENV=production bundle exec rake assets:precompile
and repeat it for all other css files to understand which one contains the error. This time the output of this command will be helpful and refer exactly to the problem. Then, it would be easy to find the error and fix it.
Ruby on Rails Rake assets:precompile error - Command failed with status (1) - CScript Error: Execution of the Windows Script Host failed
I was able to solve this issue by transferring the project into a Linux environment (Ubuntu) and running the bundle exec rake assets:precompile
. It appeared to work, I believe this sort of issue is something to do with windows. If starting any kind of development to do with RoR stick to Linux.
Related Topics
Best Way to Highlight Current Page in Rails 3? - Apply a CSS Class to Links Conditionally
Yaml How Many Spaces Per Indent
Typing 'Rails Console' Doesn't Start
What's the Point of Unary Plus Operator in Ruby
Understanding the Gemfile.Lock File
What Does 'If _File_ == $0' Mean in Ruby
Gem.Source_Index Is Deprecated, Use Specification. Should I Re-Install Gem or Rails
Simple Way of Turning Off Observers During Rake Task
Why Does Array.Slice Behave Differently for (Length, N)
Why Can't Singleton Methods Be Defined on Symbols or Fixnums
Ruby 1.9 + Sinatra Incompatible Character Encodings: Ascii-8Bit and Utf-8