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.
In a local environment
terminal
$ node --version
v12.16.1
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.