question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Circle CI build failed

See original GitHub issue

When I try to run tests with Circle CI v2 using npm, build fails after running npm ci:

#!/bin/bash -eo pipefail
npm ci
/bin/bash: npm: command not found
Exited with code 127

This is my circleci.yml config:

version: 2
jobs:
  build:
    working_directory: /var/www
    docker:
      # using custom image, see .circleci/images/primary/Dockerfile
      - image: circleci/cci-demo-docker-primary:0.0.2
      - image: cypress/base:8
        environment:
          ...
          TERM: xterm
    parallelism: 1
    steps:
      - checkout
      - run:
          ...
      - restore_cache:
          key: v2-deps-{{ .Branch }}-{{ checksum "package.json" }}
          key: v2-deps-{{ .Branch }}-
          key: v2-deps-
      - run: npm ci
      - save_cache:
          key: v2-deps-{{ .Branch }}-{{ checksum "package.json" }}
          paths:
            - ~/.npm
            - ~/.cache
      - run: $(npm bin)/cypress run --record --key <my_record_key>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
bioancommented, Oct 31, 2020

@stephyswe Late reply, but you can replace npm ci with yarn install --frozen-lockfile . Rest should run just fine with npm commands used in the examples they provide, I believe.

4reactions
jennifer-shehanecommented, Jul 24, 2018

@saadaouad You’ll need to run npm i locally in order to generate and commit the package-lock.json file to be read by your CI. The npm ci command exclusively uses the package-lock.json file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CircleCi build failed - Build Environment
Hi, Sometimes i get build failed in CircleCi for first time, and if i rebuild the test it works well, i don't know...
Read more >
Exit Build Early if Any Test Fails - CircleCI Support
Cancel On Test Fail Using API​​ Some notes about the above solution: It will cancel the workflow instead of moving it to a...
Read more >
Build Fails Using 'apt-get update' Command - CircleCI Support
We're starting to see reports of CircleCI builds failing due to an error when running apt-get update . The problem we're tracking is...
Read more >
Troubleshooting Unexplained Build Failures - CircleCI
Just remember, the next time that your build spontaneously fails, it is because something has changed. Fortunately, CircleCI provides solutions ...
Read more >
How I learned to stop worrying and love failed builds - CircleCI
Real failures​​ Getting a red build isn't a failure. But there are certainly scenarios in CI which are real failures, and which are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found