Rails precompile assets on Heroku Sprockets::FileNotFound - heroku

I try to deploy my simple Rails app to Heroku. This app is just attempt to use bower with Heroku.
Unfortunately I have problems with precompile assets on Heroku.
This gives me error Sprockets::FileNotFound.
remote: -----> Preparing app for Rails asset pipeline
remote: Running: rake assets:precompile
remote: rake aborted!
remote: Sprockets::FileNotFound: couldn't find file './app/App'
remote: (in /tmp/build_fe6dc0e2c0063705b279b26e4aa2432d/app/assets/javascripts/application.js:12)
I don't know what can be the cause. App.js is my own file and it surely exists.
Need to mention that rake assets:precompile work properly on my local machine.
This is my applications.js which includes all other files
//= require jquery
//= require jquery_ujs
//= require vendor/angular/angular
//= require vendor/angular-route/angular-route
//= require vendor/angular-resource/angular-resource
//= require vendor/angular-sanitize/angular-sanitize
//= require vendor/moment/moment
//= require vendor/angular-moment/angular-moment
//= require ./app/App
//= require ./app/router
//= require_tree ./app/controllers
//= require_tree ./app/directives
//= require_tree ./app/filters
In some similar questions I found advice to run heroku repo:purge_cache.
But this failed to me too.
~/tmp/repo_tmp $ cd unpack
~/tmp/repo_tmp/unpack $ tar -zxf ../repo-cache.tgz
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
All source code is published at GitHub
https://github.com/ivanovalexey/bowerrr
Could some one help me figure it out?
Thank you.

Solved. The problem was with file name ./app/App.js. I renamed it to ./app/main.js and it worked. Still wonder why it doesn't matter locally.

Related

Rails 4 Assets are not compiling in production environment

My app is running in dev environment. I am using JQCloud.
Its working fine in development mode but when i run following command
RAILS_ENV=production rake assets:precompile
All assets precompile but after running my server in production mode i am getting following error.
jQCloud is not a function
application.css.scss
*= require_tree .
*= require_self
*= require font-awesome
*/
appication.js
//= require jquery
//= require jquery_ujs
//= require bootstrap-sprockets
//= require_tree .
dashing widegts index.js
//= require_tree .
//= require highcharts/highstock
//= require highcharts/highcharts-more
//= require highcharts/modules/exporting
//= require jquery-ui
//= require jqcloud
Facing error following errors
Uncaught TypeError: $(...).jQCloud is not a function
Uncaught ReferenceError: Highcharts is not defined

Ruby: require downloaded gems

I have finished writing a ruby script which I would like to share with others, but I am having trouble getting the user to install the necessary gems. I have tried 2 approaches, and a fix for either of them would be greatly appreciated! I require the following gems:
require 'rubygems'
require 'highline/import'
require 'mechanize'
I have tried the following:
1) Generate a stand-alone app with Platypus. I created the Gemfile:
source "https://rubygems.org"
gem "highline", "~> 1.6.20"
gem "mechanize", "~> 2.7.3"
and bundle installed it and included require 'bundler/setup'. I uploaded Gemfile.lock and the ruby script but I receive this error when I run it:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in require': cannot load such file -- highline/import (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:inrequire'
from /Users/jonathanli/Documents/CS_projects/iSites/Isites.app/Contents/Resources/script:5:in `'
2) I downloaded the gem files and placed them directly in my host folder. I am unsure of how to modify my require statements, but it is not working as it stands right now.
Thanks in advance everyone! Hope this was enough detail.

Ruby on rails application fails to run on one machine but runs on another (same setup)

I have problem with moving Ruby on Rails app between two machines,
Both of them have exactly the same OS and setup (Arch linux x86_64 updated today),
(well, this can not be true, because this problem happens, but I'm unable to spot any differences at the moment)
both have rails in version 3.2.12 and ruby 1.9.3
On my laptop everything works fine, app runs correctly,
on desktop command
rake assets:precompile
fails with error:
/usr/bin/ruby /usr/bin/rake assets:precompile:all RAILS_ENV=development RAILS_GROUPS=assets
rake aborted!
couldn't find file 'jquery'
(...)
I have this in my application.js:
//= require jquery
//= require jquery_ujs
//= require_tree .
and gem 'jquery-rails' in my Gemfile (bundle install completes successfully)
but this is probably irrelevant - rake fails in exactly same wqay without this gem installed.
I tried running rails server, webpage shows error:
cannot load such file -- sass
(in [path])
Problem must lay somewhere in my ruby/rails installation on desktop, app source is kept in git, both machines have the same revision with clean working dir - tmp is in .gitignore.
Asset pipeline is enabled in config/application.rb
I tried the following:
Deleted tmp directory
Reinstalled rails, jquery and couple of other gems
Used other environments (rake fails in all of them)
Downloaded jquery and put it in assets dir (this is supposed to be automatic in rails),
i this case rake assets:precompile fails on sass stylesheet compilation (I have sass-rails installed!)
I must be missing something obvious here, anyone had this problem before?
Do I need to purge my ruby installation or is there a simpler way to solve this?
(ps. Sorry about my poor English)

Asset pipeline in a Rails 3.2.11 app works fine with Ruby 1.9.3 but stops working in Ruby 2.0.0

My asset pipeline was working fine in Ruby 1.9.3. When I upgrade to 2.0.0 It stops working.
In Gemfile:
gem 'jquery-rails'
In application.js file:
//= require jquery
//= require jquery_ujs
//= require bootstrap-affix
//= require bootstrap-alert
...
//= require jquery_nested_form
//= require sitengine.js
//= require_tree .
Result from .../assets/application.js in browser:
//= require jquery
//= require jquery_ujs
//= require bootstrap-affix
//= require bootstrap-alert
...
//= require jquery_nested_form
//= require my_app.js
//= require_tree .
;
Two questions:
Have you experienced this? If you have, would love to have a comment from you.
Have you found a solution? (Thanks in advance for your answer.)
Thanks!
I updated all my gems with bundle update and that did the trick.
No idea why, probably some gems were updated for ruby 2.

Rack/Sinatra LoadError: cannot load such file

I'm trying to build an app using Sinatra, Ruby, rack, haml, pony and SendGrid, with git and RVM for deployment on Heroku. The app is a blog variant that should send out an email with commentary submitted on a form. On my local server, when the form submits I get the following error:
LoadError at /
cannot load such file -- pony
file: tools.rb location: require line: 314
BACKTRACE
(expand)
/Users/Kevin/prog/ruby/Sinatra/Noobs/noobs.rb in block in <top (required)>
require 'pony'
When run on Heroku, form submittal results in an internal server error. The 'cannot load such file' error suggests that the file is not on the gem path, but if I understand correctly, the OS disagrees:
➜ noobs git:(master) ✗ bundle show pony
/Users/Kevin/.rvm/gems/ruby-1.9.3-p194#noobs/gems/pony-1.4
➜ noobs git:(master) echo $GEM_PATH
/Users/Kevin/.rvm/gems/ruby-1.9.3-p194#noobs:/Users/Kevin/.rvm/gems/ruby-1.9.3-p194#global
Here is the code where pony is required (noobs.rb):
require 'rubygems'
require 'sinatra'
require 'haml'
require "sinatra/reloader" if development?
# ...
post '/' do
require 'pony'
Pony.mail(:from => params[:name] + "<" + params[:contact] + ">",
What do I need to do to get pony to work?
require "bundler/setup"
Will probably fix your error.
Since you are using Bundler with Sinatra you need to require Bundler for the bundled gems to work. You probably have your gems split between Bundler and your gemset. If you have Sinatra and Haml in your gemset but Pony in your Gemfile you will see a LoadError.
I write down name of the gem (pony - in my case) in Gemfile - and it starts to work.
Just open Jemfile - and write down words jem "pony" in the new line I get the following paste2.org/6hVxHXKH

Resources