Heroku: Could not find a JavaScript runtime
Given the error message I'm guessing this is a Rails 3.1 on the old stack, called Bamboo.
Heroku recommends the cedar stack for Rails 3.1 and they have a tutorial here on how to get that going.
Rails - Could not find a JavaScript runtime?
Installing a javascript runtime library such as nodejs solves this
To install nodejs on ubuntu, you can type the following command in the terminal:
sudo apt-get install nodejs
To install nodejs on systems using yum, type the following in the terminal:
yum -y install nodejs
ExecJS and could not find a JavaScript runtime
Ubuntu Users
I'm on Ubuntu 11.04 and had similar issues. Installing Node.js fixed it.
As of Ubuntu 13.04 x64 you only need to run:
sudo apt-get install nodejs
This will solve the problem.
CentOS/RedHat Users
sudo yum install nodejs
javascript runtime in rails 3.1.0 and ruby 1.9.2. cant deal with with heroku. Did everything, but still does not working
I'm using Rails 3.1 on Heroku with the assets pipeline, in addition to the assets group in my gemfile I have;
group :production do
gem 'therubyracer-heroku'
end
which seems to be what you're missing,
Heroku Javascript runtime error
I had this same problem after a six month hiatus from using Heroku.
It turned out I needed to use the 'cedar' stack and change the deployment URL to use the new installation.
In my app directory:
heroku create --stack cedar
git remote set-url heroku git@heroku.com:blooming-river-1759.git
git push heroku master
http://dsimard.posterous.com/assets-problems-with-heroku-and-rails-31
http://devcenter.heroku.com/articles/cedar
Rails 3.1.1 deploy to Heroku failing
In the end I resolved this by deleting my .git directory, initialized a new repo with git init and re-committed everything. Not ideal, but the only way I could solve this.
rake aborted! Could not find a JavaScript runtime
The reason is pretty self explanatory and says that a JS runtime was not available. You can explicitly add that dependency by adding rubyracer
gem to your rails application, and that should include the JS runtime, for you.
So, add gem 'therubyracer'
to your Gemfile
, and then, run bundle
command, again. Then, you can run your rake
or rails
commands, as desired :)
If that does not solve your problem, install node.js
on your system, and that should solve your problem, for sure. You can use:
sudo apt-get install nodejs # on ubuntu
brew install node # on mac-osx, if you have `homebrew` installed.
Related Topics
Preventing Child from Firing Parent's Click Event
Reading Non-Inline CSS Style Info from JavaScript
Example of How to Load Static CSS Files from Node_Modules Using Webpack
Why Does the Setinterval Callback Execute Only Once
Data-Toggle Tab Does Not Download Leaflet Map
How to Extend an Existing JavaScript Array with Another Array, Without Creating a New Array
Viable Options for Running Nodejs on Android (Aug 2017)
Detect iOS Version Less Than 5 with JavaScript
JavaScript Console.Log() in an iOS Uiwebview
Why Can't I Access a Property of an Integer with a Single Dot
How to Communicate Between Related React Components
Adding a Parameter to the Url with JavaScript
Include a JavaScript File in Shiny App
Web Worker Settings for Chrome
Mocha/Chai Expect.To.Throw Not Catching Thrown Errors
How to Count String Occurrence in String
Mydiv.Style.Display Returns Blank When Set in Master Stylesheet