Registry / devops / exec-sync

exec-sync

JSON →
library0.1.6jsnpmunverified

A Node.js package to execute shell commands synchronously. Current version 0.1.6, last updated in 2012. Designed for migration scripts and CLI tools, but explicitly warns against using in regular server code due to blocking the event loop. Provides a simple synchronous API for shell execution, but lacks error handling and has cross-platform issues. Not actively maintained.

npm install exec-sync
INSTALL
IMPORT
SIG · EXEC-SYNC
E
exec-sync
devopsjavascriptv0.1.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
var execSync = require('exec-sync');
import execSync from 'exec-sync';
Package is CommonJS only; does not support ESM imports.
default
const execSync = require('exec-sync');
const execSync = require('exec-sync').default;
Module exports a function directly, not an object with default property.
execSync
const execSync = require('exec-sync');
const { execSync } = require('exec-sync');
The package exports a single function, not a named export.

Shows basic usage of execSync to run shell commands synchronously and capture output.

var execSync = require('exec-sync'); // Get current user var user = execSync('echo $USER'); console.log('User:', user); // List directory contents var files = execSync('ls -la'); console.log('Files:', files);
Debug
Known issues
breakingexec-sync: %s is not a function
fix
Ensure you are using require('exec-sync') not destructuring or named import.
affects: >=0.1.0
deprecatedPackage is unmaintained; use child_process.execSync() instead
fix
Replace with const { execSync } = require('child_process'); (Node.js >=0.12)
affects: all
gotchaexec-sync blocks the event loop
fix
Do not use in production server code; use child_process.exec() or spawn() for async.
affects: all
gotchaexec-sync does not throw errors on failure
fix
Check the return value or use child_process.execSync which throws on non-zero exit.
affects: all
Errors
Common errors & fixes
execSync is not a function
Attempting to import the package using ES6 import or destructuring require.
fix
Use const execSync = require('exec-sync');
Cannot find module 'exec-sync'
Package not installed or npm install failed.
fix
Run 'npm install exec-sync --save'
execSync: command not found
The shell command is not in PATH or misspelled.
fix
Verify command exists and use absolute path if necessary.
Upgrade
Version history
0.1.6latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
exec-sync — npm install exec-sync · libregistry