Warning: node.js detection failed, sbt will use the Rhino based Trireme JavaScript engine
Asked Answered
L

6

20

I'm new to Play framework. Please explain the meaning of the below warning.

Warning: node.js detection failed, sbt will use the Rhino based Trireme JavaScript engine instead to run JavaScript assets compilation, which in some cases may be orders of magnitude slower than using node.js

I don't want anything that slow down my application so please advice if I should change the JS Engine to Node.js, but my PlayFramework project is using Java on the server side.

Largish answered 18/7, 2015 at 14:0 Comment(1)
H
11

You need to install Node.js and then tell the sbt/java engine to use it.

  brew install node

Edit .bash_profile and add:

   export SBT_OPTS="${SBT_OPTS} -Dsbt.jse.engineType=Node -Dsbt.jse.command=$(which node)"

This eliminated the warning for me on OSX

Houdan answered 24/8, 2015 at 20:1 Comment(1)
Thanks. Works just fine without setting SBT_OPTS though.Dandruff
B
5

In Windows:

  • Install node.js
  • Go to Control Panel - System and Security - System - Advanced system settings
  • Click Environment Variables...
  • Search in System variables for SBT_OPTS
    • If such exists, click Edit... and concatenate -Dsbt.jse.engineType=Node to Variable value
    • If such does NOT exist, click New... and write SBT_OPTS to Variable name and -Dsbt.jse.engineType=Node to Variable value
  • Click OK - OK - OK
  • Restart any command prompt (cmd, PowerShell) that is currently running Play Framework
Blasius answered 10/2, 2016 at 14:42 Comment(0)
E
4

in ubuntu

curl -sL https://deb.nodesource.com/setup | sudo bash -

sudo apt-get install -y nodejs

then add as above to your .profile in your home directory

export SBT_OPTS="${SBT_OPTS} -Dsbt.jse.engineType=Node -Dsbt.jse.command=$(which node)"

then

 . ./.profile 

to reload your .profile

For a more flexible install using node version manager check the following tutorial: how to install node js on an ubuntu 14.04 server

Build again and the warning about using the Trireme stuff should be gone.

Eligibility answered 28/12, 2015 at 21:4 Comment(0)
C
2

As an alternative to setting the environment variable, you can add this line to your build.sbt file:

JsEngineKeys.engineType := JsEngineKeys.EngineType.Node

See: https://github.com/sbt/sbt-js-engine

Copyreader answered 29/3, 2016 at 4:10 Comment(0)
L
1

sbt plugins requiring a JS engine are used only in the build process, and so missing Node.js only slows down assets building stages if you use any.

The built application is not affected.

Anyway, you may want to install node.js to your PATH, where it should be auto-detected.

Lusterware answered 14/1, 2018 at 12:6 Comment(0)
L
0

in Windows 10:

Install node.js from https://nodejs.org/en/ (The installer automatically adds node.js to your PATH)

then add:

export SBT_OPTS="$SBT_OPTS -Dsbt.jse.engineType=Node"

to your plugins.sbt in

. ./project/plugins.sbt

Worked for me - the warning has disappeared!

EDIT: Apparently plugins.sbt was the wrong place to add the

export SBT_OPTS="$SBT_OPTS -Dsbt.jse.engineType=Node"

...although the warning disappeared when loading my app, it led to an error when relaunching the app a couple of hours later:

error: not found: value export

I would be glad if anyone could help and tell me where to put the export.

Levitation answered 15/1, 2016 at 10:43 Comment(1)
export is a bash command. Chances are, you don't run sbt on Windows using bash wrapper, so the recipe does not apply to Windows. Most probably, something like set may be used in a .bat wrapper instead.Lusterware

© 2022 - 2024 — McMap. All rights reserved.