node-makensis
raw JSON → 3.0.5 verified Fri May 01 auth: no javascript
A TypeScript wrapper for the NSIS (Nullsoft Scriptable Install System) compiler, makensis. Current stable version is 3.0.5 (released 2025). Requires Node.js >=18 and NSIS >=3.06. Provides a promise-based API to compile installer scripts, retrieve version/help/license information, and manage compiler options like defines, verbose output, and environment variables. Ships TypeScript types. Supports Deno via JSR. Key differentiator: modern ESM-native library with full TypeScript typings, replacing raw child_process calls with a robust, type-checked interface. Maintained on GitHub, with regular updates and CI.
Common errors
error Error: spawn makensis ENOENT ↓
cause makensis executable not found in system PATH.
fix
Install NSIS and ensure makensis is in PATH, or set pathToMakensis option.
error TypeError: Cannot read properties of undefined (reading 'stdout') ↓
cause Using an outdated version (<3.0.0) that relies on events, but trying to access stdout directly.
fix
Upgrade to makensis@3 and use the returned Promise values instead of events.
error import { compile } from 'makensis'; SyntaxError: Cannot use import statement outside a module ↓
cause Running in a CommonJS context without configuring ESM (e.g., no 'type': 'module' in package.json).
fix
Add "type": "module" to package.json, or use .mjs extension.
Warnings
breaking makensis v3.0.0 broke support for NSIS <3.06. Maker must upgrade NSIS to at least 3.06. ↓
fix Install NSIS 3.06 or later (https://nsis.sourceforge.io/Download).
breaking makensis v3.0.0 removed event support. Previously available events (e.g., 'data', 'error') are no longer emitted. ↓
fix Remove event listeners; use the returned Promise or the dedicated methods like compile().
breaking makensis v3.0.0 removed support for .env files. Environment variables must be passed explicitly via the `env` option or process.env. ↓
fix Use the `env` option in compiler options to pass environment variables, or rely on process.env directly.
breaking makensis v3.0.0 requires Node.js >=18. Older Node versions are no longer supported. ↓
fix Upgrade Node.js to version 18 or later.
deprecated The `makensis@2` series is deprecated and only maintained for legacy NSIS support (<3.06). ↓
fix Migrate to makensis@3 and upgrade NSIS to 3.06+.
gotcha If makensis is not in PATH, you must set the `pathToMakensis` option. Otherwise compile will fail with 'ENOENT'. ↓
fix Set `pathToMakensis` in options to the full path of the makensis executable.
Install
npm install makensis yarn add makensis pnpm add makensis Imports
- compile wrong
import { default as compile } from 'makensis'correctimport { compile } from 'makensis' - commandHelp wrong
const commandHelp = require('makensis').commandHelpcorrectimport { commandHelp } from 'makensis' - NSIS (namespace) wrong
import NSIS from 'makensis'correctimport * as NSIS from 'makensis'
Quickstart
import { compile } from 'makensis';
const options = {
verbose: 2,
define: {
SPECIAL_BUILD: true,
LANGUAGE: 'English'
}
};
try {
const output = await compile('path/to/installer.nsi', options);
console.log('Compiler output:', output);
} catch (error) {
console.error(error);
}