Error ExecJS :: RuntimeUnavailable: What to do when it occurs

Occurrence phenomenon

The following Error occurs when executing $ rake secret when setting environment variables when setting the Web server and application server on AWS EC2.

terminal


ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
/var/www/chat-space/config/application.rb:7:in `<top (required)>'
/var/www/chat-space/Rakefile:4:in `require_relative'
/var/www/chat-space/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)

→ Javascript is not running well, so install Node.js.

install confirmation

In a local environment

terminal


$ node --version
v12.16.1

Install in AWS production environment

terminal


sudo yum install nodejs --enablerepo=epel ← execute
Loaded plugin:priorities, update-motd, upgrade-helper
amzn-main                                                          | 2.1 kB  00:00:00     
amzn-updates                                                       | 3.8 kB  00:00:00     
epel/x86_64/metalink                                               | 5.3 kB  00:00:00     
epel                                                               | 4.7 kB  00:00:00     
nodesource                                                         | 2.5 kB  00:00:00     
(1/3): epel/x86_64/group_gz                                        |  74 kB  00:00:00     
(2/3): epel/x86_64/updateinfo                                      | 789 kB  00:00:00     
(3/3): epel/x86_64/primary_db                                      | 6.1 MB  00:00:00     
1073 packages excluded due to repository priority protections
Resolving dependencies
-->Performing transaction confirmation.
--->Package nodejs.x86_64 2:6.17.1-Install 1nodesource
-->I'm dealing with dependencies: python >= 2.6 packages: 2:nodejs-6.17.1-1nodesource.x86_64
-->Performing transaction confirmation.
--->Package python26.x86_64 0:2.6.9-2.89.Install amzn1
-->I'm dealing with dependencies: libpython2.6.so.1.0()(64bit)Package: python26-2.6.9-2.89.amzn1.x86_64
-->Performing transaction confirmation.
--->Package python26-libs.x86_64 0:2.6.9-2.89.Install amzn1
-->Dependency resolution finished.

Resolved the dependency

==========================================================================================
Package architecture
Version repository capacity
==========================================================================================
During installation:
 nodejs               x86_64        2:6.17.1-1nodesource          nodesource         13 M
Dependency related installation:
 python26             x86_64        2.6.9-2.89.amzn1              amzn-main         5.8 M
 python26-libs        x86_64        2.6.9-2.89.amzn1              amzn-main         697 k

Transaction summary
==========================================================================================
Installation 1 package(+Two dependency packages)

Total download capacity: 20 M
Installation capacity: 59 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/latest/nodesource/packages/nodejs-6.17.1-1nodesource.x86_64.rpm:Header V4 RSA/SHA512 Signature, key ID 34fa74dd: NOKEY
nodejs-6.17.1-1nodesource.x86_64.rpm public key is not installed
(1/3): nodejs-6.17.1-1nodesource.x86_64.rpm                        |  13 MB  00:00:00     
(2/3): python26-libs-2.6.9-2.89.amzn1.x86_64.rpm                   | 697 kB  00:00:00     
(3/3): python26-2.6.9-2.89.amzn1.x86_64.rpm                        | 5.8 MB  00:00:01     
------------------------------------------------------------------------------------------
16 MB in total/s |  20 MB  00:00:01     
file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-Obtaining the key from EL.
Importing GPG key 0x34FA74DD:
 Userid     : "NodeSource <[email protected]>"
 Fingerprint: 2e55 207a 95d9 944b 0cc9 3261 5ddb e8d4 34fa 74dd
 Package    : nodesource-release-el7-1.noarch (installed)
 From       : /etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
Perform the above processing. is this good?[y/N]y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
During installation: python26-libs-2.6.9-2.89.amzn1.x86_64                     1/3 
During installation: python26-2.6.9-2.89.amzn1.x86_64                          2/3 
During installation: 2:nodejs-6.17.1-1nodesource.x86_64                        3/3 
During verification: 2:nodejs-6.17.1-1nodesource.x86_64                        1/3 
During verification: python26-2.6.9-2.89.amzn1.x86_64                          2/3 
During verification: python26-libs-2.6.9-2.89.amzn1.x86_64                     3/3 

Installation:
  nodejs.x86_64 2:6.17.1-1nodesource                                                      

I have installed dependency related:
  python26.x86_64 0:2.6.9-2.89.amzn1        python26-libs.x86_64 0:2.6.9-2.89.amzn1       

Has completed!

With the above, javascript can be run even in the production environment.

Recommended Posts

Error ExecJS :: RuntimeUnavailable: What to do when it occurs
What to do when javax.batch.operations.JobStartException occurs
What to do when a javax.el.PropertyNotWritableException occurs
What to do when IllegalStateException occurs in PlayFramework
What to do and how to install when an error occurs in DXRuby 1.4.7
What to do if an error occurs when nokogiri enters when bundle install
What to do if ClassNotFoundException occurs when starting Tomcat
What to do if an ActionController :: UnknownFormat error occurs
What to do when it becomes Unable to find CDI BeanManager.
What to do when an UnsupportedCharsetException occurs in a lightweight JRE
What to do if a SAX Parser error occurs when using Liferay 7 / DXP on AWS
What to do when undefined method ʻuser_signed_in?'
[Rails 6] What to do when a missing a template error occurs after introducing haml [Super easy]
What to do if an error occurs when doing npm install axios in React + Typescript project
no space left on device What to do if an error occurs
What to do if you get an error when you hit Heroku logs
Notes on what to do when a WebView ClassNotFoundException occurs in JavaFX 12
What to do when debugging "Source not found"
What do you use when converting to String?
What to do when is invalid because it does not start with a'-'
[Ubuntu] What to do when MongoDB cannot be started due to a SocketException error
What to do when The SSL certificate has expired
What to do when JSF tags do not become HTML
What to do when rails creates a 〇〇 2.rb file
ParseException: What to do when Unparseable date is reached
After installing'devise''bootstrap' of gemfile with rails, what to do when url is an error
What to do if you get a port error when docker-compose up on Mac
What to do when Method not found in f: ajax
What to do when you launch an application with rails
What to do if mysql2 gets a bundle install error
What to do if you get a "Cannot Pull Container Error" when starting ECS ​​Fargate
Bluemix Infrastructure VPN does not connect because it does not support NPAPI! What to do when [Mac]
What to do when an error occurs in rails db: migrate ((StandardError: An error has occurred, this and all later migrations canceled :))
[Rails] What to do when the error No database selected and Unknown database appears in db: migrate
What to do if you get a gcc error in Docker
What to do if you go offline due to SSL certificate error when running Jenkins on Mac
[Programming beginner] What to do when rails s becomes an error in the local development environment
What to do when the changes in the Servlet are not reflected
[Ruby] What to do when the error "cannot load such file" appears when executing VS Code debug
What to do if an SSH key authentication error occurs during automatic deployment to EC2 with Capistrano
[Rails] What to do when rails s does not respond or does not stop
What to do if you get a DISPLAY error in gym.render ()
java.security.InvalidKeyException: What to do when Illegal key size or default parameters
What to do after Vagrant install
What to do if you get a JNI shared library error when trying to build in Eclipse
What to do when you become a Problem During Content Assist
What to do when you run into a docker-compose node_modules problem
What to do if an error occurs in VS Code when importing a django module or your own module installed by pip install
It should be the same as the sample when logging in to Twitter, but an error occurs ~ resolution
What to do if you should have installed Rails but an error occurs with rails -v (for beginners)
Add gem'rails-i18n','~> 6.0.0' and what to do if bundle install gives an error
What to do if you get an error during rails db: reset
What to do when "npm ERR! Code ENOSELF" is displayed after npm install
What to do if you get an uninitialized constant Likes Controller error
[Android Studio] What to try when you get into error spitting hell
What to do when Blocked Host: "host name" appears in Ruby on Rails
Notes on what to do when EC2 is set up with t2.micro
What to do if tomcat process remains when tomcat is stopped in eclipse
What to do when "call'Hoge.connection' to establish a connection" appears on rails c
What to do after updating Dockerfile, docker-compose.yml
Error when trying to use heroku command