Test job fails because env-cmd command is not found

javascript
npm
circle.yml
workflow

#1

Hi,

I am trying to configure a workflow in CircleCi 2.0 containing 3 jobs. I based the workflow on this example: https://github.com/CircleCI-Public/circleci-demo-workflows/blob/workspace-forwarding/.circleci/config.yml. The workflow contains three jobs:

  1. checkout_code
  2. build
  3. test

The first job does a checkout and persists to a workspace so that i can attach this in the two other jobs.
The second job runs two npm script which will run npm install, link all the packages with the lerna bootstrap command and as last command npm run build.
The third job also runs an npm script which should run the tests, but the env-cmd package used in the npm script cannot be found.

Is there someone who had a similar problem or knows what I’m doing wrong?

This is my config file:

version: 2
jobs:
  checkout_code:
    docker:
      - image: circleci/node:6.10
    working_directory: home/circleci/phoenix
    steps:
      - checkout
      - persist_to_workspace:
          root: .
          paths: .
  build:
    docker:
      - image: circleci/node:6.10
    working_directory: home/circleci/phoenix
    steps:
      - attach_workspace:
          at: /home/circleci/phoenix
      - run:
          name: Install npm packages and link @zicket/packages with the bootstrap command
          command: npm run bootstrap
      - run:
          name: Build the code
          command: npm run build
  test:
    working_directory: home/circleci/phoenix/packages/ticketing-integration-tests
    docker:
      - image: circleci/node:6.10
    steps:
      - attach_workspace:
          at: /home/circleci/phoenix
      - run:
          name: Run the ticketing integration tests
          command: npm run test
      - store_artifacts:
          path: coverage

workflows:
  version: 2
  build_and_test:
    jobs:
      - checkout_code
      - build:
          requires:
            - checkout_code
      - test:
          requires:
            - checkout_code
            - build

#2

Hello @joachimvdnab,

Could you try to change variations of “home/circleci/phoenix” and “/home/circleci/phoenix” in your config to all be ~/phoenix?


#3

Hi @zzak,
Sorry for the late response, I will try and let you know if it fixed my problem.
Thanks in advance.


#4

Hi @zzak,

The problem still persist. Am I correct to assume that all the packages from the mono repo are accessible through the workspace I created in the checkout job? And if I would then build and link them in the second job, is that then persisted to the workspace to use in the third job?


#5