NPM can't be found by circle



Hi there!

I’m starting to use circle 2.0 and faced specific failure. npm install returns

#!/bin/bash -eo pipefail
npm install

/bin/bash: npm: command not found
Exited with code 127

What’s going wrong?

version: 2
      # documented at
      - image: circleci/elixir:1.4
      - image: circleci/postgres:9.4
      - image: circleci/node:6.10

    working_directory: ~/brutalist
      - checkout

      # Node
      - run: npm install
      - run: npm build:frontend

      - save_cache:
          key: node
            - node_modules

      # Elixir
      - run: mix deps.get
      - run: mix ecto.create
      - run: mix ecto.migrate

      - save_cache:
          key: elixir
            - _build
            - deps
      - image: circleci/elixir:1.4
      - image: circleci/postgres:9.4
      - image: levlaz/elasticsearch-docker-ci:5.1.1
    working_directory: ~/brutalist
      - checkout

      - restore_cache:
            - node
            - elixir

      - run: npm run link
      - run: mix test

Build link:


@asiniy This is because the Elixir Docker image does not have npm installed. If you look at the documentation for “Specifying Container Images”, under the heading “Using Multiple Docker Images” it explains that listing multiple container images should be used when you have external services you depend on (such as a database or caching system). It’s not designed for when you have secondary languages to support.

In a multi-image configuration job, all steps are executed in the container created by the first image listed.

Your solution is to either install npm as part of your CircleCI run when the Elixir image runs or build a custom Docker image containing all the necessary components you need for building and testing your application.

I’d recommend you take a look at the following topics with issues similar to yours:


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.