The nodejs plugin

The nodejs plugin is useful when working with Node.js or npm JavaScript based parts.

The plugin uses node to install dependencies from package.json. It also sets up binaries defined in package.json by adding them to PATH.

This plugin uses the common plugin keywords as well as those for “sources”. For more information, see Snapcraft parts metadata.

Additionally, this plugin uses the following plugin-specific keywords:

  • node-packages (list)
    A list of dependencies to fetch using npm.
  • node-engine (string)
    The version of node.js you want the snap to run on.
  • npm-run (list)
    A list of targets to npm run. These targets will be run in order, after npm install
  • npm-flags (list)
    A list of flags for npm.
  • node-package-manager (string; default: npm)
    The language package manager to use to drive installation
    of node packages. Can be either npm (default) or yarn.

For examples, search GitHub for projects already using the plugin.

This is a snapcraft plugin. See Snapcraft plugins and Supported plugins for further details on how plugins are used.

Last updated 8 months ago. Help improve this document in the forum.