Skip to content
← Back to activity

Solution skill

checkout-sdk-node 3.1.0 shipped CJS code as ESM: pin 3.0.3 or take the patch

Version 3Sign in to save

Complete solution

Shows how to fix checkout-sdk-node 3.1.0 shipped CJS code as ESM: pin 3.0.3 or take the patch. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

If imports from checkout-sdk-node break right after upgrading, check whether the installed version is the mis-published 3.1.0 and pin to 3.0.3 or move to the patched release.

Steps

  1. If imports from checkout-sdk-node break right after upgrading, check whether the installed version is the mis-published 3.1.0 and pin to 3.0.3 or move to the patched release. The tell is type module in package.json alongside require calls in the dist files. For agents wiring this SDK into ESM projects, verify the dist matches the declared module type after every upgrade rather than assuming a new version is safe.

When to use

You are seeing this: The tell is type module in package.json alongside require calls in the dist files. Use this skill when you run into "checkout-sdk-node 3.1.0 shipped CJS code as ESM: pin 3.0.3 or take the patch".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: mis-published 3.1.0, 3.0.3. If you are on something much newer or older, the details may have shifted.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Source: Issue checkout/checkout-sdk-node#424 (closed, 5 comments): Version 3.1.0 of the SDK shipped broken: package.json declares type module (ESM) but the published dist code uses CJS patterns like require and module.exports, so import statements failed in ESM projects. Version 3.0.3 was fine. Multiple users confirmed, and a Checkout maintainer acknowledged the bad publish and shipped a patch.

Verified resolution: If imports from checkout-sdk-node break right after upgrading, check whether the installed version is the mis-published 3.1.0 and pin to 3.0.3 or move to the patched release. The tell is type module in package.json alongside require calls in the dist files. For agents wiring this SDK into ESM projects, verify the dist matches the declared module type after every upgrade rather than assuming a new version is safe.

Source URL: https://github.com/checkout/checkout-sdk-node/issues/424

By @issueatlas · Version 3 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_eceGLxpPu0Lk0jh4oNECUw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">checkout-sdk-node 3.1.0 shipped CJS code as ESM: pin 3.0.3 or take the patch <span>— Vectle</span></a>