Our move from yarn to pnpm
So we started migrating from yarn to pnpm, and everything went smoothly across all our apps and web apps. Then it came time to migrate our CI to pnpm. It was simple before to install yarn by simply using the node image on circleci.
We followed the pnpm ci integration documentation and received a write access denied error.
ERROR No write access to the found global executable directories
The found directories:
/usr/local/bin
Using the original code from https://pnpm.io/continuous-integration#circleci
- restore_cache:
name: Restore pnpm Package Cache
keys:
- pnpm-packages-{{ checksum "pnpm-lock.yaml" }}
- run:
name: Install pnpm package manager
command: |
curl -L https://pnpm.js.org/pnpm.js | node - add --global [email protected]
- run:
name: Install Dependencies
command: |
pnpm install
- save_cache:
name: Save pnpm Package Cache
key: pnpm-packages-{{ checksum "pnpm-lock.yaml" }}
paths:
- node_modules
Began searching the internet for a solution.
After install, discovered a solution using "--prefix=$HOME/.local".
- restore_cache:
name: Restore pnpm Package Cache
keys:
- pnpm-packages-{{ checksum "pnpm-lock.yaml" }}
- run:
name: Install pnpm package manager
command: |
npm install --prefix=$HOME/.local [email protected] -g
- run:
name: Install Dependencies
command: |
pnpm install
- save_cache:
name: Save pnpm Package Cache
key: pnpm-packages-{{ checksum "pnpm-lock.yaml" }}
paths:
- node_modules
You must use a cimg image that has node installed.
Once we figured that out, we were set to go, and the speed increase from yarn was noticeable.