PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, September 26, 2022

[FIXED] How to solve: yarn package not found on CircleCi?

 September 26, 2022     circleci, continuous-deployment, continuous-integration, javascript     No comments   

Issue

I have been trying to learn CircleCi workflows by building simple jobs and I keep getting this error: /bin/bash: yarn: command not found.

So all the steps run but when it comes to the job is self it stops. So spin up environment, preparing env variables, checkout code, Restore Yarn Package Cache are green(successful).

My workflow below:


default-environment: &default-environment
  docker:
    - image: cimg/base:2020.01

step-restore-build-cache: &step-restore-build-cache
  restore_cache:
    name: Restore Yarn Package Cache
    keys:
      - yarn-packages-{{ checksum "yarn.lock" }}

step-save-build-cache: &step-save-build-cache
  save_cache:
    name: Save Yarn Package Cache
    key: yarn-packages-{{ checksum "yarn.lock" }}
    paths:
      - ~/.cache/yarn

step-run-cache: &step-run-cache
  run:
    name: Install Dependencies
    command: yarn install --immutable

version: 2.1
jobs:
  build:
    <<: *default-environment
    steps:
      - checkout
      - <<: *step-restore-build-cache
      - run:
          name: Build
          command: yarn run build
      - <<: *step-save-build-cache
  lint:
    <<: *default-environment
    steps:
      - checkout
      - <<: *step-restore-build-cache
      - run:
          name: Lint
          command: yarn run lint
  format:
    <<: *default-environment
    steps:
      - checkout
      - <<: *step-restore-build-cache
      - run:
          name: Format
          command: yarn run format
  type-check:
    <<: *default-environment
    steps:
      - checkout
      - <<: *step-restore-build-cache
      - run:
          name: Type-check
          command: yarn run type-check
workflows:
  version: 2
  build-and-lint:
    jobs:
      - build
      - lint
      - format
      - type-check

Not really sure how to fix this..

Thank you very much :)


Solution

You're using cimg/base:2020.01 which is a general purpose image and does not have node or the yarn binary installed. You should use the cimg/node image which has yarn pre-installed.



Answered By - Idan Elhalwani
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing