Finishing Up
Published: 2021-12-11 03:41:02

I recently wrote a [post](https://dev.to/menghif/transition-to-pnpm-4alf) explaining how to get started using the `pnpm` package manager with [telescope](https://github.com/Seneca-CDOT/telescope). Today I want to talk about the process of getting to the "[Merged PR](https://github.com/Seneca-CDOT/telescope/pull/2545)" finish line.

### Navigating through problems

Getting `pnpm` to work on telescope was far from smooth. It all started with silly bugs. For example I removed a dependency (`npm-run-all`) that I thought was not needed just to realize that the front-end would break in all sorts of ways.

### GitHub Actions

Once I fixed all the small errors and was satisfied with the local implementation, I started to work on changing the GitHub Actions CI to also use `pnpm`. After many unsuccessful attempts, I was relieved to see that all the GitHub Actions jobs passed. My `pnpm` implementation worked!

But things were not over... After making a small change in the docs, I pushed a new commit and then saw this:

`ERR_PNPM_OUTDATED_LOCKFILE  Cannot install with "frozen-lockfile" because pnpm-lock.yaml is not up-to-date with package.json`

How was this possible? I did not make any new changes to any of the `package.json` or `pnpm-lock.yaml` files and now CI stopped working.

After speaking with [David](https://github.com/humphd), he suggested to tackle a problem that *could* have been the cause of this error: [Standardize package versions across package.json files](https://github.com/Seneca-CDOT/telescope/issues/2563) (Spoiler, this wasn't the problem).

### Standardize package versions

While working on this secondary issue, I changed all the dependencies to use the caret (^) version and the only one that gave me some trouble was [Prettier](https://prettier.io/). It turns out that a minor update from Prettier could create new formatting changes to the files and since we were using `npm` without a lock file, our CI was failing (Thanks [Duke](https://github.com/DukeManh) for finding this out!).
It took a few more failed CI attempts (mainly due to connection issues) for this [PR](https://github.com/Seneca-CDOT/telescope/pull/2572) to be ready.

### Back to `pnpm`

Before including the changes made in my secondary PR, I decided to try one more time to wipe all `npm_modules`, reinstall `pnpm`, rebase my branch, run `pnpm install` and finally push the newly created `pnpm-lock.yaml` file.

Just like *magic*, all the GitHub Actions jobs passed!

The simple explanation is that the `pnpm-lock.yaml` file had problems and despite my many attempts to generate a *working* copy, it took this **one** extra try to fix it. I suspect it was due to having originally installed `pnpm` from a [script](https://pnpm.io/installation#nodejs-is-preinstalled) and then not having it properly removed from my system before reinstalling it with `npm install -g pnpm`.

### Sticking with it

I had a few days where I felt like all the work was for nothing because there were numerous problems that I could not figure out.

In a way I am glad that I encountered so many obstacles because it allowed me to dive deeper in my understanding of package managers and Continuous Integration with GitHub Actions.

I want to end this post by saying that I am very pleased with the feedback I received from everyone in the telescope community after they started using `pnpm`. Seeing all the positive comments made everything I worked on in the last few week even more worth it!