Bug
Every published version of the postiz npm CLI I tested (2.0.13, 2.0.15, 2.1.0 — latest at time of filing) fails on every command, including --version and auth:status, with:
Error [ERR_REQUIRE_ESM]: require() of ES Module .../node_modules/postiz/node_modules/node-fetch/src/index.js from .../node_modules/postiz/dist/index.js not supported.
Instead change the require of .../node-fetch/src/index.js in .../postiz/dist/index.js to a dynamic import() which is available in all CommonJS modules.
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at Object.<anonymous> (.../postiz/dist/index.js:48:33) {
code: 'ERR_REQUIRE_ESM'
}
Cause
package.json declares node-fetch: ^3.3.2, which is ESM-only (no CJS build). dist/index.js is itself CommonJS (no "type": "module" in package.json) and calls require('node-fetch') directly instead of either:
- bundling node-fetch into the CJS output (esbuild/rollup with proper interop), or
- using a dynamic
import(), or
- pinning to
node-fetch@2.x (last CJS-compatible major).
Environment
- Node.js v22.11.0, Windows 11
- Installed via
npm install -g postiz@2.1.0 (also reproduced on 2.0.13, 2.0.15)
Impact
The CLI is completely unusable out of the box — no command runs, including read-only ones like --version.
Suggested fix
Either bundle the whole dist/index.js (including deps) with esbuild targeting CJS, or pin node-fetch@^2.7.0, or add "type": "module" + convert the entrypoint and shebang accordingly.
Bug
Every published version of the
postiznpm CLI I tested (2.0.13, 2.0.15, 2.1.0 — latest at time of filing) fails on every command, including--versionandauth:status, with:Cause
package.jsondeclaresnode-fetch: ^3.3.2, which is ESM-only (no CJS build).dist/index.jsis itself CommonJS (no"type": "module"in package.json) and callsrequire('node-fetch')directly instead of either:import(), ornode-fetch@2.x(last CJS-compatible major).Environment
npm install -g postiz@2.1.0(also reproduced on 2.0.13, 2.0.15)Impact
The CLI is completely unusable out of the box — no command runs, including read-only ones like
--version.Suggested fix
Either bundle the whole
dist/index.js(including deps) with esbuild targeting CJS, or pinnode-fetch@^2.7.0, or add"type": "module"+ convert the entrypoint and shebang accordingly.