How do I use multiple Orbs in a single config file?

Hi. I’m working on a project that requires me to use multiple orbs. I have a Flask API and a Node.JS app in the same directory. I intend to use both the Python orb and the node orb in the same configuration to run tests. How do I put such a configuration together?

I’ve sought help from this post here, but I still miss it.

A more basic example can be found here

2 orbs are listed and then used in the rest of the script - as they are referenced using different names they are totally independent of each other.

1 Like

Thanks for the pointer. Below is my current config; I get this error "Unable to find your package.json file. Did you forget to set the app-dir parameter?" I’m aware I need to add a line of this kind : app-dir: ~/CircleCI-MultipleOrbs/flask-api and app-dir: ~/CircleCI-MultipleOrbs/nodejs-cli. My question is, where exactly do I add these two so that the package.json and requirements.txt are found. Both projects are in the same directory with my .circleci directory in the root.

version: 2.1

  node: circleci/node@5.0.2
  python: circleci/python@1.1.0

    executor: python/default
      - checkout
      - python/install-packages:
          pkg-manager: pip
      - python/install-packages:
          pip-dependency-file: requirements.txt
          pkg-manager: pip
      - python/install-packages:
          args: pytest
          pkg-manager: pip
          pypi-cache: false
      - run:
          command: |
            pytest -v
          name: Test

      - build
      - node/test:
          test-results-for: jest

That is an error caused by the use of an orb, rather than you trying to include more than one orb and comes from the defaults used by circleci/node@5.0.2

One of the parameters for both orbs is ‘app-dir’ which you need to set if node’s package.json or the python project does not sit at root or in ~/project. There are older posts indicating that others have been caught out by this as all the examples are coded around the defaults.

You may also want to look at updating the version of the python orb that you are using.

1 Like

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