Pin a Clerk SDK
Dependency pinning allows you to specify exact package versions in your project, ensuring consistent behavior across different environments and preventing unexpected updates from breaking your application.
Typically, package managers use semantic versioning (SemVer) ranges when installing packages. When you install your Clerk SDK, you'll typically see an entry like "@clerk/nextjs": "^1.1.0"
in your package.json. The caret (^) symbol means "any version that is compatible with 1.1.0" - this includes patch releases (1.1.1, 1.1.2) and minor releases (1.2.0, 1.3.0) but excludes major releases (2.0.0).
Another range operator is the tilde (~) symbol for more restrictive versioning. An entry like "@clerk/nextjs": "~1.1.0"
means "any version from 1.1.0 up to (but not including) 1.2.0" - this only allows patch updates within the same minor version.
When you pin a dependency, you specify the exact version without any range operators. For example, "@clerk/nextjs": "1.1.0"
means "use exactly version 1.1.0, no other version." This approach gives you complete control over which version your application uses.
With Clerk, we recommend pinning your Clerk SDK in both of these ways:
- Pin your Clerk SDK in your
package.json
file to a specific version (no range operators).package.json "@clerk/nextjs": "1.1.0"
- Set the
clerkJsVersion
property when you initialize the Clerk integration. For most SDKs, this is done in the<ClerkProvider>
component. For SDKs like Astro or Nuxt, this is done in the configuration file.<ClerkProvider clerkJsVersion="1.1.0">
Feedback
Last updated on