Using npm artifact repositories

npm is usually configured using the npm config command, writing values to the .npmrc files. However, configuration values can also be set using the environment variables beginning with NPM_CONFIG_.

The Javascript/Typescript plug-in used in Eclipse Che does not download any artifacts. It is enough to configure npm in the dev-machine component.

Use the following environment variables for configuration:

  • The URL for the artifact repository: NPM_CONFIG_REGISTRY

  • For using a certificate from a file: NODE_EXTRA_CA_CERTS

To be able to reference the certificate in a devfile, get a copy of the certificate of the npm repository server and put it inside the /project folder.

  1. An example configuration for the use of an internal repository with a self-signed certificate:

      - mountSources: true
          - name: nodejs
            port: 3000
        memoryLimit: '512Mi'
        type: 'dockerimage'
        alias: 'nodejs'
        image: ''
          -name: NODE_EXTRA_CA_CERTS
           value: '/projects/config/tls.crt'
         - name: NPM_CONFIG_REGISTRY
           value: ''