Blueprints

Install custom Node packages from package.json before running a Node.js script

Source

yaml
id: node-custom-package
namespace: company.team

tasks:
  - id: script
    type: io.kestra.plugin.scripts.node.Script
    inputFiles:
      package.json: |
        {
          "name": "your_project_name",
          "version": "1.0.0",
          "type": "module",
          "dependencies": {
            "colors": "^1.4.0"
          }
        }
    beforeCommands:
      - npm install
    script: |
      import colors from 'colors';
      console.log(colors.red("Hello"));

About this blueprint

Docker

This blueprint shows how to run a Node.js script with a custom package.json. If you don't want to write the file inline, you can add it from the UI editor or use the git.Clone task to retrieve the package.json file from a git repository.

Script

More Related Blueprints

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra