Node modules

Different extensions do not share their dependencies. If two extensions use the same dependency, they both need to define it.

Corteza Corredor supports internal and external node modules, both on the server-scripts and client-scripts.

Internally, we use the Yarn package manager. We suggest you do the same.

To add a new node module either:
  • manually insert it into the package.json file or

  • run the yarn add NAME_GOES_HERE.

When ran, the Corredor server attempts to automatically resolve and install the requested dependencies.

We are observing some anomalies when running Yarn inside a docker container.

If you’re getting an error message similar to the one below, it means that Yarn is not able to install the dependencies. This error occurs when Yarn is unable to store its cache.

{ "type": "error", "data": " Extracting tar content of undefined failed, the file appears to be corrupt: \\"ENOSPC: no space left on device, write\\"" }

To fix the anomaly, you need to:
  1. SSH into the Corredor container (docker-compose exec -u root corredor sh),

  2. cd into the mounted volume,

  3. run yarn --cache-folder /tmp.

The dependencies should now be installed and available for use. The above yarn command manually runs the installing process, discarding the cache.

Node modules can then be used just like in any other situation.

Example package.json:
  "dependencies": {
    "axios": "^0.18.0"
Example usage from automation scripts:
import axios from 'axios'

export default {
  // ...

  async exec() {
    await axios.get(...)

    // ...