Capistrano: ExecJS error when deploy - ruby-on-rails

I'm using Rails 4.2.6 and Debian 8.5 and I'm following this guide to deploy my Rails app.
When I deploy my app, I get ExecJS error. See my deployment logs here.
What I've done but doesn't work:
Installing NodeJS on server
Add execjs and therubyracer in Gemfile
Install execjs and therubyracer in server
All 3 not working for me.
What should I do? What am I missing here?

Did you try running bundle exec rake assets:precompile locally? Are you getting any errors?
It seems something wrong with your JS file.
Since the unexpected '#' character was found on line 13941 of your example then you'll find your comments on that same line.

The error message of note seems to be ExecJS::ProgramError: Unexpected character '#' (line: 13941, col: 0, pos: 384252). You have a hash (#) char somewhere in you JS which is not being understood by the JS parser. It says that the char is on line 13,941, position 384,252. That sounds like minified code to me, so it may be vendored JS or JS that is in the middle of being processed.
I'd suggest auditing all of your JS for the # symbol. Grep or The Silver Searcher will be useful.

Related

Could not find i18n-0.6.7 in any of the sources

I am trying to push my Rails app to Heroku and I am getting the following error:
Could not find i18n-0.6.7 in any of the sources
Gemfile.lock has the following line:
i18n (0.6.9)
When I do a Google search about my problem I found out that i18n-0.6.7 has been yanked. My project runs fine in development but when I push to production in Heroku is when I get this error.
Any ideas? Running bundle update, bundle install etc... has not yielded me any results.
Thanks!
The problem is indeed that the version has been yanked, and therefore heroku cannot install it while compiling your push. The reason it works locally is because you still have that library on your machine.
Take a look at your Gemfile.lock and find instances of the i18n gem. When they are far indented, the lines above them in the hierarchy are the ones that list i18n as a dependency. Try updating those gems first.

undefined method `action_mailer' during Capistrano deployment

I'm having this error message come up during Capistrano deployment. It implies to me that something's wrong with Rails being installed or something? Rails is not currently installed on the server side, but it's in my Gemfile (and my Gemfile.lock), so I'm assuming it should be installed during the bundle install command that gets executed before this line.
The actual command that's giving the error is:
bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile
I guess the problem is just that Rails is not being installed during the bundle install. Am I missing something?
Thanks!
UPDATE 1: Rails appears to be installing correctly via the bundle install command. If I check out the directory .../shared/bundle/ruby/1.9.1/gems, I can see action mailer in there.
UPDATE 2: Running the command rake assets:precompile actually fails locally as well, so this doesn't have anything to do with Capistrano it would appear. Now I just have to figure out why the config object doesn't know anything about action mailer?
UPDATE 3: Hot on the trail. It looks like my installed version of actionmailer is 0.6.1 (?!), meanwhile all the rest of my Rails stuff is up at 3.2.9. bundle update refuses to update actionmailer past this version. I'm going to remove all of my gems and start fresh.
UPDATE 4: Deleted my entire gemset using rvm gemset empty. Then tried to run bundle again, and again it tries to get actionmailer 0.6.1. I think something is screwed up with bundler or something...
The problem ended up being that I had removed a dependency upon a specific version of Rails in my Gemfile. I just had gem "rails" in there. That seemed to completely botch the dependency calculations, because it was getting super-old versions of action mailer rather than getting a consistent version from all gems. Guess it's a bad idea to not specify an exact Rails version. Yikes!
#aardvarkk,
Thanks for posting this issue, I was having the same error with my installation of Rails 4.0.0 and the error was preventing me from running my rails server
This is while I'm trying to follow the Hartl Tutorial for RoR.
I added gem "rails", '4.0.0' to my gem file and now I'm able to run my rails server.
Thank you

Having issues with gem version when running Cucumber

I originally posted the question: What does this Cucumber error message mean?
Following the suggestion of uninstalling builder and running bundle worked, for a while. Now I am getting a similar error, but this time on rack.
When I run cucumber features I get the following (previously cucumber has worked):
can't activate rack (~> 1.2.1,
runtime) for ["actionpack-3.0.7",
"railties-3.0.7"], already activated
rack-1.3.0 for ["rack-test-0.6.0",
"cucumber-rails-0.5.0"]
(Gem::LoadError)
Deleting rack just to get cucumber to work doesn't sound like a really good idea to me. How can I fix this problem so it doesn't come back again on another dependency?
I think you could put the exact version numbers for your gems (including Cucumber) in your Gemfile and then run using bundle exec
bundle exec cucumber
This will run the Cucumber version in your Gemfile, which should always keep things working even when you upgrade your system version.
The other option is to use RVM gemsets

Path's issue with bundler, to change or not to change?

I'm trying to setup a new rails 3 project with bundler, but i ran into issues with bundler.
I'm on rails 3.0.3 with ruby 1.8.7
When trying to do
$ bundle exec rake db:migrate
I get the following error
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/dependency.rb:52:in `initialize': Valid types are [:development, :runtime], not nil (ArgumentError)
Same goes for when I try to issue a regular rake task in my terminal, one like
$ rake -T i.e., only then I get the error:
uninitialized constant Bundler /Users/daniel/cc/contributie_data/Rakefile:4 (See full trace by running task with --trace)
I've been reading some other questions regarding this problem, therefore i've learned it has something to do with paths...
$ which rake
/usr/bin/rake
$ which ruby
/usr/local/bin/ruby
Can anyone give me some suggestions about what could be happening here?
And even more important, how I can get bundler to play nice with rake..
Thanks for any input on this, much appreciated!
I got the same error (I'm using rvm). It turned out that in both my .profile and .bashrc was the following statement:
export PATH=~/.gem/ruby/1.8/bin:$PATH
So this path was taken instead of the rvm path. I commented these lines out and now everything works fine
Try to delete Gemfile.lock. It usually helps with
Valid types are [:development, :runtime], not nil
error.
Oh man, I just when through this today.
I did an update, and my rvm broke -- started throwing up on missing scripts and the like. I just got finished completely reinstalling rvm and my rubies.
it's not great, and it takes a while but it's what I did to get back to a working state.
Started here. How can I remove RVM (Ruby Version Manager) from my system? Ended up going through and installing fresh.
I too face the same issue and resolved it with the help of this link github:bundler
Modified a line in the file lib/bundler/resolver.rb which is reside inside bundler gem. Remove * mark from the line d = Gem::Dependency.new(base.first.name, *reqs)
like this:
reqs = [dep.requirement.as_list, base.first.version.to_s].flatten.compact
d = Gem::Dependency.new(base.first.name, *reqs)
to
reqs = [dep.requirement.as_list, base.first.version.to_s].flatten.compact
d = Gem::Dependency.new(base.first.name, reqs)
*modifying content of a gem directly is not a good practice. Posted this just to show another way to resolve this issue.

"ERROR Errno::EPIPE: Broken pipe" with Culerity

I've recently installed culerity to use on top of cucumber. But when I run my cucumber specs, they turn red (they were all green before).
The errors I get have this form:
Celerity::Exception::NavigationException:
com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException:
500 Internal Server Error for
http://localhost:3001/
(Culerity::CulerityException)
features/admin.feature:82:in `And I am
logged in'
When I look at the web server console (launched by rake culerity:rails:start), the error is:
ERROR Errno::EPIPE: Broken pipe
I've noticed that these errors happen whenever I have cucumber steps (like "go to") that do $browser.goto.
Any idea ?
PS: I have made sure that JRuby is installed and in my path
i believe that an upgrade of jruby to a version matching the patch level of ruby that we were running solved our issue, we had to install jruby from source to get the right one
This is what the readme for the gem states:
I get a broken pipe error:
* make sure JRuby is installed and in your path: running jruby -v should not
produce an error
maybe this is related to the issue that i experienced: http://github.com/langalex/culerity/issues/#issue/29
We ran into a similar problem (broken pipe) with a Rails app on Bundler:
server = Culerity::run_server
didn't actually start the server, leaving
Culerity::RemoteBrowserProxy.new(server, …)
high and dry.
Turns out Bundler messes with RUBYOPT env var (see how Bundler modifies the environment for details), bin/run_celerity_server.rb (from the culerity gem) runs with JRuby as interpreter and JRuby honors RUBYOPT.
As Bundler is not a JRuby gem, the script does not start the server. Culerity::run_server must be invoked in a Bundler-free environment (i.e., with a clean RUBYOPT)

Resources