Skip to content

Commit 9e13593

Browse files
committed
Add Pin Specific pnpm Version For Builds as a Vercel TIL
1 parent 02a56c7 commit 9e13593

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
1010

1111
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
1212

13-
_1257 TILs and counting..._
13+
_1258 TILs and counting..._
1414

1515
---
1616

@@ -1286,6 +1286,7 @@ _1257 TILs and counting..._
12861286
- [Add Web Server Layer Redirects](vercel/add-web-server-layer-redirects.md)
12871287
- [Deploy An App Without Pushing An Empty Commit](vercel/deploy-an-app-without-pushing-an-empty-commit.md)
12881288
- [Naming Of The Vercel Config File](vercel/naming-of-the-vercel-config-file.md)
1289+
- [Pin Specific pnpm Version For Builds](vercel/pin-specific-pnpm-version-for-builds.md)
12891290
- [Share Development Environment Variables Via CLI](vercel/share-development-environment-variables-via-cli.md)
12901291

12911292
### Vim
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Pin Specific pnpm Version For Builds
2+
3+
Vercel recognizes when [a project contain a `pnpm-lock.yaml`
4+
file](https://vercel.com/changelog/projects-using-pnpm-can-now-be-deployed-with-zero-configuration)
5+
and will automatically use [`pnpm`](https://pnpm.io/) for builds of that
6+
project.
7+
8+
It looks for [the `lockfileVersion` in `pnpm-lock.yaml` to determine what major
9+
version of `pnpm` to
10+
install](https://vercel.com/docs/concepts/deployments/configure-a-build#install-command).
11+
If the `lockfileVersion` is `5.4`, then it will use the latest pnpm v7.
12+
Otherwise it will fallback to the latest pnpm v6.
13+
14+
That's the extent of the control you have over the `pnpm` version. That is,
15+
unless you are to use [this experimental corepack
16+
feature](https://vercel.com/docs/concepts/deployments/configure-a-build#corepack).
17+
Set the `ENABLE_EXPERIMENTAL_COREPACK` environment variable to `1` in your
18+
project's _Environment Variables_ under _Settings_.
19+
20+
Then specify the `pnpm` version with the `packageManager` key in your
21+
`package.json`.
22+
23+
```json
24+
{
25+
"packageManager": "[email protected]"
26+
}
27+
```
28+
29+
Even though the current latest is `7.13.5`, Vercel will see the Corepack
30+
environment variables and the `packageManager` version and use `7.13.2`
31+
instead.
32+
33+
See [this PR](https://github.com/skillrecordings/products/pull/535) and [this
34+
issue](https://github.com/prisma/prisma/issues/12921#issuecomment-1284425847)
35+
for more details.

0 commit comments

Comments
 (0)