Caching Global Dependencies in 2.0

nodejs
caching
circle.yml

#1

How would I go about caching global dependencies with version 2.0?

install_dependencies
  docker:
  - image: circleci/node:latest
working_directory: ~/test-and-toss
steps:
  - attach_workspace:
      at: ~/test-and-toss
  - restore_cache:
      keys:
        - yarn-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
        - yarn-cache-{{ .Branch }}
        - yarn-cache-
  - run: yarn install
    # expect this to be located at `/node_modules/bin/now`
    # instead it's not being cached and later on I will get `now: command not found`
  - run: sudo yarn global add now 
  - save_cache:
      key: yarn-cache-{{ .Branch }}-{{ checksum "yarn.lock" }}
      paths: node_modules
  - persist_to_workspace:
      root: .
      paths: .

#2

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