DMPbelgium / roadmap

5 stars 1 forks source link

Could not find a JavaScript runtime on test-dmponline.be #86

Closed StCyr closed 1 year ago

StCyr commented 1 year ago

Hello @nicolasfranck,

on test-dmponline.be, I get this error when I try to run bin/rails console:

root@roadmap-test:/opt/roadmap# bin/rails console
/opt/roadmap/vendor/bundle/ruby/3.0.0/gems/execjs-2.8.1/lib/execjs/runtimes.rb:58:in `autodetect': Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
    from /opt/roadmap/vendor/bundle/ruby/3.0.0/gems/execjs-2.8.1/lib/execjs.rb:5:in `<module:ExecJS>'
    from /opt/roadmap/vendor/bundle/ruby/3.0.0/gems/execjs-2.8.1/lib/execjs.rb:4:in `<main>'
    from /opt/roadmap/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
    from /opt/roadmap/vendor/bundle

any idea how to fix it?

nicolasfranck commented 1 year ago
export EXECJS_RUNTIME=Disabled

that should be already in the environment as discussed, everywhere

StCyr commented 1 year ago

It's there:

!/bin/sh

# cleans up previous shutdown
rm -f /opt/roadmap/tmp/pids/server.pid

# Sets up environment
export DB_ADAPTER=postgresql
export RAILS_ENV=production
export RAILS_SERVE_STATIC_FILES=true
export ORCID_CLIENT_ID="xxxxxxxxxxxxxxxxxx"
export ORCID_CLIENT_SECRET="xxxxxxxxxxxxxx"
export BASE_URL="https://test.dmponline.be"
export MALLOC_ARENA_MAX=2
export EXECJS_RUNTIME=Disabled
export DMP_HOST="test.dmponline.be"
export DMPROADMAP_HOST="test.dmponline.be"
export DMP_PROTOCOL="https"
export DMP_SMTP_ADDRESS="postfix"
export RAILS_LOG_TO_STDOUT=true

I think it only applies to /bin/rails server -b 0.0.0.0 though.

nicolasfranck commented 1 year ago

@StCyr you probably need to read in those variables in your environment too, as they are probably now only added on server startup.

StCyr commented 1 year ago

Indeed,

needs RAILS_ENV=production too though

nicolasfranck commented 1 year ago

@StCyr mm yes right. In development there are some hidden assumptions about available development tools like nodejs etc