esno
raw JSON → 4.8.0 verified Fri May 01 auth: no javascript maintenance
esno is a Node.js runtime enhanced with esbuild for loading TypeScript and ESM files. It is an alias for tsx since v0.15, providing automated CJS/ESM mode and caching. Current stable version is 4.8.0. The project is in maintenance mode, with issues redirected to tsx. Key differentiators include zero-config TypeScript execution, esbuild-based transpilation for speed, and seamless CJS/ESM interop. It replaces older tools like ts-node.
Common errors
error Cannot find module 'esno' ↓
cause esno is only a CLI; no programmatic module exports.
fix
Use 'tsx' for programmatic usage or run via CLI with npx.
error esno: command not found ↓
cause esno not installed globally or locally.
fix
Run 'npx esno' or install globally: 'npm i -g esno'.
Warnings
deprecated esno v0.15+ is now an alias of tsx; standalone esno is deprecated. ↓
fix Use tsx directly for new projects.
breaking Incorrect import path for commonjs usage ↓
fix Use tsx's conditional exports; esno does not export programmatic API.
Install
npm install esmo yarn add esmo pnpm add esmo Imports
- default (CLI usage) wrong
npx esno index.jscorrectnpx esno index.ts - install as dependency wrong
npm i -g esnocorrectnpm i esno
Quickstart
// First install: npm i -g esno
// Create hello.ts
export function greet(name: string): string {
return `Hello, ${name}!`;
}
console.log(greet('World'));
// Run with:
// esno hello.ts