Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
CdktnCli
✓ import { CdktnCli } from 'cdktn-cli'
✗ const CdktnCli = require('cdktn-cli')
ESM-only since v0.22.0; CommonJS require() fails in Node >=16
main
✓ import { main } from 'cdktn-cli/bin/index.js'
✗ import { main } from 'cdktn-cli'
main() is not exported from root; must use deep import in ESM
Providers
✓ import { Providers } from '@cdktn/providers'
✗ import { Providers } from 'cdktn-cli'
Providers are in separate @cdktn/* packages, not in cli
Shows basic usage: import CdktnCli, create App, define stack, and synth to generate Terraform JSON.
import { CdktnCli } from 'cdktn-cli';
const app = new CdktnCli.App();
new MyStack(app, 'my-stack', { env: { region: 'us-east-1' } });
app.synth();
cdktf --version
Debug
Known issues
breakingPackage renamed from 'cdktf-cli' to 'cdktn-cli' in v0.22.0; all existing imports break.fixReplace all `import from 'cdktf-cli'` with `import from 'cdktn-cli'`
affects: <0.22.0
breakingTypeScript pinned to 5.x in v0.22.1; using TS 4.x causes syntax errors.fixnpm install typescript@^5.0.0
affects: >=0.22.1
deprecatedConfig key 'cdktf.json' is deprecated; migrate to 'cdktn.json'fixRename cdktf.json to cdktn.json in project root
affects: >=0.22.0
gotchaESM-only: require() not supported in Node >=16; use import/import()fixSet { "type": "module" } in package.json or use .mjs extension affects: >=0.22.0
gotchaEnvironment variable CDKTF_* still read for legacy support; may conflict with CDKTN_*fixUnset CDKTF_* env vars if using CDKTN_* to avoid unexpected overrides
affects: >=0.22.0 <0.23.0
Errors
Common errors & fixes
Error: Cannot find module 'cdktn-cli'
Package renamed to cdktn-cli after v0.22.0
fixRun: npm uninstall cdktf-cli && npm install cdktn-cli
TypeError: cdktn_cli_1.CdktnCli is not a constructor
CommonJS require() used with ESM-only package
fixChange to ESM import: import { CdktnCli } from 'cdktn-cli' SyntaxError: Unexpected token 'export'
Running TypeScript <5.x with cdktn-cli v0.22.1 which expects TS 5.x
fixInstall TypeScript 5.x: npm install -D typescript@^5.0.0
ENOENT: no such file or directory, open 'cdktf.json'
Config file renamed to cdktn.json in v0.22.0
fixRename cdktf.json to cdktn.json or create cdktn.json
Audit
Dependencies
cdktnoptionalPeer dependency for compiled provider modules