Build Node.js Applications

Using Node.js, you can develop applications that run JavaScript on a server. For more information, see https://nodejs.org.

Set Up a VM Build Executor and a Build Executor Template with Node.js

Before you can create a build step that uses Node.js, your organization administrator must create a build executor template that includes the Node.js software and add a VM build executor that uses that build executor template. The build executor template can be created from scratch or software can be added to an existing build executor template.

Note:

To find your organization administrator, click Contacts under your user profile. Your administrator, or a list of administrators, will display.

See Create and Manage Build Executor Templates in Administering Visual Builder Studio.

After the organization administrator adds a VM build executor to the build executor template, you can create and configure a job to use that build executor template and add a Node.js script.

Configure a Job to Build a Node.js Application

Here's how you create and configure a job that builds a Node.js application:

  1. If you have a Node.js script, upload it to the project Git repository.
  2. Open the job’s configuration page.
    If you're creating a job, in Template in the New Job dialog box, select the Node.js build executor template. Jump to step 5.
  3. Click Settings the Gear icon.
  4. In the Software tab, select the Node.js build executor template.
  5. Click Configure Configure.
  6. In the Git tab, add the Git repository where you uploaded the script file.
  7. Click the Steps tab.
  8. From Add Step, select Node.js.
  9. To specify the script file, in Source, select NodeJS File. In NodeJS File Path, specify the file path in the Git repository.

    To specify the script, in Source, select Script. In NodeJS Script, enter the script.

  10. To speed up build execution time, you can use a Unix Shell step to install NPM packages globally on your VM build executor(s), by running NPM commands with the --global option.

    Modules such as Gulp, Grunt, Bower, and Oracle DB Node package come preinstalled on a Compute VM. Not all modules are available across all versions of Node and these packages get out of date and are superseded by newer versions rather quickly.

    By using the --global option, you can install the NPM packages you need on a VM build executor and doing so will also make those packages available to subsequent builds that run on the same VM build executor. This results in a significant time saving over installing the same packages locally, which requires them to be reinstalled in every subsequent build.

    Global packages are important, but you should avoid using them if they aren't needed. In general, the rule of thumb is:
    • If you’re installing something to be used in your program, make it required, then install it locally, at the root of your project.
    • If you’re installing something to be used in your shell or on the command line, install it globally, so its binaries end up in your PATH environment variable.
  11. Click Save.