Using Node.js Module

Supported Node.js Version

webOS TV supports the different versions of Node.js core modules depending on the webOS version as below.

webOS Version

Node.js Version

webOS 1.x


webOS 2.x


webOS 3.x


webOS 4.x


webOS 5.0


webOS 6.0


Using Node.js Core Modules

To use the Node.js core module, add the module with a top-level identifier to your service as the following code.

var Service = require('webos-service');
var md5 = require('md5');

var service = new Service("com.yourdomain.helloworldservice.service");

service.register("hello", function(message) {
        data: "Hello, " + md5( + "!"

Using Third-party Modules 

There are many third-party modules for Node.js. To use the third-party modules, follow the next steps.

  1. Use NPM (Node Package Manager) tool on your computer to install the third-party module. The module is installed in the node_modules directory under the node.js installation folder. 
    See Node Packaged Modules (NPM) for the search and installation of these modules.

  2. Create a node_modules directory in your service's root directory. 

  3. Copy modules from the node_modules directory under the node.js folder to the node_modules directory under your service's root directory.

Now, add the third-party module to your service as the following code. The node will find the module from the node_modules directory first.  

var md = require('md5');
You cannot use modules that include C/C++ addons. You must use modules implemented with JavaScript only.