The npm plugin

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

This plugin can only be used with a base of core20. For core18 and core, use the nodejs plugin instead.

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.

base: core20

This plugin uses the following plugin-specific keyword:

  • npm-node-version (string)
    The version of node.js you want the snap to run on and includes npm, as would be downloaded from (https://nodejs.org).

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

Requires Snapcraft version 4.0+.

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

nodejs-version should be npm-node-version

Else you get: Additional properties are not allowed ('nodejs-version', were unexpected)

2 Likes

The difference there, @bart, is between using core18 vs core20. Plugins were all updated for core20 and the options made more consistently named between plugins.

Edit: oops, I forgot this plugin only works with core20 :woman_facepalming: