Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-cli-node-minimum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@agent-native/core": patch
---

Enforce the package's Node.js 22.22.0 minimum in the CLI before scaffolding.
20 changes: 20 additions & 0 deletions packages/core/src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,26 @@ try {
_version = pkg.version;
} catch {}

// Fail fast on unsupported Node versions. The package engine is only
// advisory — npx/pnpm merely warn — so without this an older Node first fails
// deep inside a scaffold dynamic import with a cryptic ERR_MODULE / syntax
// error that `handleScaffoldImportError` misreports as a corrupt npx cache.
const REQUIRED_NODE_MAJOR = 22;
const REQUIRED_NODE_MINOR = 22;
const _nodeVersion = process.versions.node;
const _nodeIsStable = /^\d+\.\d+\.\d+$/.test(_nodeVersion);
const [_nodeMajor, _nodeMinor] = _nodeVersion.split(".").map(Number);
const _unsupportedNode =
!_nodeIsStable ||
_nodeMajor < REQUIRED_NODE_MAJOR ||
(_nodeMajor === REQUIRED_NODE_MAJOR && _nodeMinor < REQUIRED_NODE_MINOR);
if (_unsupportedNode) {
console.error(
`agent-native requires Node.js ${REQUIRED_NODE_MAJOR}.${REQUIRED_NODE_MINOR}.0 or newer, but you're on Node ${process.versions.node}.\n` +
`Upgrade Node (https://nodejs.org) and re-run. With nvm: \`nvm install ${REQUIRED_NODE_MAJOR}\`.`,
);
process.exit(1);
}
/**
* Build a redacted "command" tag from process.argv. Strips the value that
* follows any --token / --key / --secret / --password / --api-key flag so
Expand Down
Loading