Skip to content
This repository has been archived by the owner on Apr 17, 2020. It is now read-only.

Unable to compile assets on production #41

Open
grepruby opened this issue Jul 3, 2013 · 21 comments
Open

Unable to compile assets on production #41

grepruby opened this issue Jul 3, 2013 · 21 comments

Comments

@grepruby
Copy link

grepruby commented Jul 3, 2013

Gem file entry:
gem 'spree_fancy', :github => 'spree/spree_fancy', :branch => '1-3-stable'

I have added below line in application.rb

config.assets.precompile += %w( store/shared/_print.css )

But still getting another issue -
Undefined variable: "$c_green"

could you please provide me guidance so that I can get do the proper assets compilation on production.

@radar
Copy link
Contributor

radar commented Jul 3, 2013

Does this error happen when you run rake assets:precompile?

On Thu, Jul 4, 2013 at 12:35 AM, Grep Ruby [email protected]
wrote:

Gem file entry:
gem 'spree_fancy', :github => 'spree/spree_fancy', :branch => '1-3-stable'
I have added below line in application.rb
config.assets.precompile += %w( store/shared/_print.css )
But still getting another issue -
Undefined variable: "$c_green"

could you please provide me guidance so that I can get do the proper assets compilation on production.

Reply to this email directly or view it on GitHub:
#41

@grepruby
Copy link
Author

grepruby commented Jul 4, 2013

Yes, when I am trying to deploy on heroku as well as running this command on my local on production mode.

@kennym
Copy link

kennym commented Jul 7, 2013

Same issue for me.

@grepruby
Copy link
Author

I have fixed this issue from my end just by adding following gem out side of assets group in gem file:

gem 'compass'
gem 'compass-rails'

Thanks Ryan to provide such a nice gem.

@radar
Copy link
Contributor

radar commented Jul 16, 2013

@DevilCoders Should we add these two gems as dependencies of spree_fancy?

@hexcodejosh
Copy link

I'm seeing this issue right now with the 2-1-stable branch. I'm unable to compile spree_fancy's assets, and see the same $c_green error described above. If I neuter that line from the file, I just hit another one later.

Is anyone one else seeing this? I can't figure out if I'm doing something wrong or not.

I have added both compass and compass-rails as suggested above, and didn't seem to change anything. I went forward and backward a couple of compass major versions and didn't see the issue go away.

I'm stumped.

@radar
Copy link
Contributor

radar commented Oct 23, 2013

Hi @hexcodejosh, can you provide us with an application that reproduces this issue please?

@hexcodejosh
Copy link

sure, I'll create something from scratch and see if I can reproduce.

@radar
Copy link
Contributor

radar commented Oct 23, 2013

Thank you!

On Wed, Oct 23, 2013 at 12:24 PM, hexcodejosh [email protected]:

sure, I'll create something from scratch and see if I can reproduce.


Reply to this email directly or view it on GitHubhttps://github.com//issues/41#issuecomment-26874249
.

Ryan Bigg
Community Manager
Spree Commerce, Inc.

@hexcodejosh
Copy link

No dice.. can't reproduce it. Here's a log of what I did in case someone else stumbles on it. I'll keep looking for some diff that triggers it.

From a fresh directory, ran following commands:

rails 4.0.0 new mystore
spree install <--- note, no auto accept option used here on purpose

josh@laptop:~/spree_fancy_test$ spree install
Would you like to install the default gateways? (Recommended) (yes/no) [yes] 
Would you like to install the default authentication system? (yes/no) [yes] 
Would you like to run the migrations? (yes/no) [yes] 
Would you like to load the seed data? (yes/no) [yes] 
Would you like to load the sample data? (yes/no) [yes] no

<accepted default admin acct info>

rails server <---- works at this point

RAILS_ENV=production bundle exec rake assets:precompile <--- runs without issue

Added following to end of Gemfile:

gem 'spree_fancy', :github => 'spree/spree_fancy', :branch => '2-1-stable'

bundle install <---- ran without errors

rails server <---- works at this point

RAILS_ENV=production bundle exec rake assets:precompile <--- works at this point

However, here are the following assets that are precompiled in this step:

josh@laptop:~/spree_fancy_test$ RAILS_ENV=production bundle exec rake assets:precompile
I, [2013-10-22T20:34:47.663565 #9398]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/store/footer-bg-3161c18db91e1e36d35542fac0c732f4.png
I, [2013-10-22T20:34:47.677690 #9398]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/store/logo-white-e4166f432687acb91a55428721980a8c.png
I, [2013-10-22T20:34:47.810579 #9398]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/store/logo-white-016a99ac9665dc941252364a5e3dc51f.svg
I, [2013-10-22T20:34:47.825912 #9398]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/store/logo-e169734ca1076c2b619d02d85346e467.png
I, [2013-10-22T20:34:47.841619 #9398]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/store/subheader-bg-56e4af77f628bd507bfc2489b832abe6.png
I, [2013-10-22T20:34:47.878007 #9398]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/store/print-3492f001aa3e8f26e0d4e9f8a49561ff.css

Its missing some of the assets, such as bx_loader.gif, icons.*, as I describe in issue:
#61

If I made that proposed fix and re-run the precompile, I get a boatload of prints, and the following assets are also compiled:

I, [2013-10-22T20:40:52.806913 #9605]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/icons-0eacfdc0140a09ed259fdaab239753a9.eot
I, [2013-10-22T20:40:52.943825 #9605]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/icons-8d3b9cfc3d91cee4fcab76cf0fe2c93c.svg
I, [2013-10-22T20:40:52.960262 #9605]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/icons-15eb6673a79fd651f411a7674cb24dae.ttf
I, [2013-10-22T20:40:52.977253 #9605]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/icons-9906b992f8f682fd4e11cc914c4b31ee.woff
I, [2013-10-22T20:40:52.993716 #9605]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/images/bx_loader-b7191bec2f9468eec52b9800bffd892c.gif
I, [2013-10-22T20:40:53.010199 #9605]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/images/controls-2a5c9523880879564e597509f280fea3.png

Hrmmmmm... it's working. How did I break my other working copy....? Have been gradually pulling in changes from my broken tree.
So far, my Gemfiles are now identical, and looks like:

source 'https://rubygems.org'

ruby '2.0.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'

# Use sqlite3 as the database for Active Record
#gem 'sqlite3'
gem 'pg'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

gem 'compass'
gem 'compass-rails'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

gem 'asset_sync'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

gem 'spree', '2.1.1'
gem 'spree_gateway', :git => 'https://github.com/spree/spree_gateway.git', :branch => '2-1-stable'
gem 'spree_auth_devise', :git => 'https://github.com/spree/spree_auth_devise.git', :branch => '2-1-stable'
gem 'spree_fancy', :github => 'spree/spree_fancy', :branch => '2-1-stable'
gem 'spree_paypal_express', :github => "radar/better_spree_paypal_express", :branch => "2-1-stable"
gem 'rails_12factor', group: :production

This also compiles.

Hrmmmm.... not sure how this happened.

@hexcodejosh
Copy link

Ah, I'm a victim of my own enthusiasm. If I modify my Gemfile to pull a tag from my fork of spree_fancy, I can reproduce it.

#gem 'spree_fancy', :github => 'spree/spree_fancy', :branch => '2-1-stable'
gem 'spree_fancy', :github => 'hexcodejosh/spree_fancy', :tag => 'add_missing_assets'

So I think my proposed fix to #61 is too aggressive and must be pulling in some files that it shouldn't. Guessing they're then getting precompiled directly, rather than being imported as they would normally...? I'll comment out the loop in that fix and see if this issue goes away.

@hexcodejosh
Copy link

@Dwarf8
Copy link

Dwarf8 commented Oct 28, 2013

I still have the same issue with spree_fancy 2-0-stable.

rake aborted!
Undefined variable: "$c_green".

@jgrannas
Copy link

I was getting "File to import not found or unreadable: store/variables_override." when i try to deploy spree fancy with capistrano. It was working fine in development.

My gemfile:
gem 'rails', '4.0.0'
gem 'spree', github: 'spree/spree', branch: '2-1-stable'
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '2-1-stable'
gem 'spree_gateway', github: 'spree/spree_gateway'
gem 'spree_fancy', :github => 'spree/spree_fancy', :branch => '2-1-stable'

But now it broke my development environment when I tried putting gem 'compass' and gem 'compass-rails' in my gemfile and deleting lock, then running bundle install. Now In development i see:

bundler/gems/spree-366514f5036e/frontend/app/views/spree/shared/_head.html.erb

File to import not found or unreadable: store/variables_override.
Load paths:
CompassRails::SpriteImporter

I've removed the compass gems and then deleted the lock file and did a bundle install again but my development is still broken

@vedant1811
Copy link

The same issue is reproducible in 2-2-stable only in production mode; occurs during rake assets:precompile . Trace: http://pastie.org/9161717

Gemfile:
source 'http://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.3'

# Use sqlite3 as the database for Active Record
# gem 'sqlite3'
# Using postgresql
gem 'pg' # also manually install packages(ubuntu): postgresql, postgresql-server-dev-all

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

group :production do
 gem 'therubyracer'
 gem 'unicorn'
end

gem 'spree', github: 'spree/spree', branch: '2-2-stable'
gem 'spree_gateway', :git => 'http://github.com/spree/spree_gateway.git', :branch => '2-2-stable'
gem 'spree_auth_devise', :git => 'http://github.com/spree/spree_auth_devise.git', :branch => '2-2-stable'
gem 'daemon_controller'

gem 'spree_fancy', :git => 'git://github.com/spree/spree_fancy.git', :branch => '2-2-stable'

group :development do
  gem 'capistrano'
  gem 'rvm-capistrano'
  gem 'rename'
  gem 'mailcatcher'
  gem 'xray-rails'
end

@vike27
Copy link

vike27 commented Jun 30, 2014

Does anyone know how to solve this?

@vedant1811
Copy link

It seems to be fixed on the latest spree 2.2

On Mon, Jun 30, 2014 at 6:13 PM, vike27 [email protected] wrote:

Does anyone know how to solve this?


Reply to this email directly or view it on GitHub
#41 (comment).

@vike27
Copy link

vike27 commented Jul 4, 2014

I am on spree 2-2 stable and running into this issue in production as well... Been a week and can't fix it...

@radar
Copy link
Contributor

radar commented Jul 7, 2014

Hi @vike27, do you have an app that I can clone and reproduce this issue in? That would help me be able to debug it.

@vike27
Copy link

vike27 commented Jul 7, 2014

The issue happens with this application:
https://github.com/vike27/surplusmerchant2

I'll be working on it this weekend, was going to try and use 2-1 stable.
Let me know if you can figure it out that way I won't have to go through
that. Thanks!

Javier

On Sun, Jul 6, 2014 at 6:11 PM, Ryan Bigg [email protected] wrote:

Hi @vike27 https://github.com/vike27, do you have an app that I can
clone and reproduce this issue in? That would help me be able to debug it.


Reply to this email directly or view it on GitHub
#41 (comment).

@flash-gordon
Copy link

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants