Skip to main content

Node/npm Compatibility

esy can install packages from npm registry.

This means esy install can also install packages which contain JavaScript code.

Accessing installed JS packages

As opposed to a standard way of installing packages into project's node_modules directory esy uses plug'n'play installation mechanism (pnp for short) pioneered by yarn.

There are few differences though:

  • esy puts pnp runtime not as .pnp.js but as _esy/default/pnp.js (or _esy/NAME/pnp.js for a named sandbox with name NAME).

  • To execute pnp enabled node one uses esy node invocation.

All binaries installed with npm packages are accessible via esy COMMAND invocation, few example:

  • To run webpack (comes from webpack-cli):

    % esy webpack
  • To run flow (comes from flow-bin package):

    % esy flow

Caveats

  • Not all npm packages currently support being installed with plug'n'play installation mechanism.

  • Not all npm lifecycle hooks are supported right now (only install and postinstall are being run).