Registry / devops / closurecompiler

closurecompiler

JSON →
library1.6.1jsnpmunverified

A Node.js wrapper for Google Closure Compiler that automatically downloads and sets up a JRE (from OpenJDK) and the compiler JAR. Version 1.6.1 (circa 2015) is the last stable release. This project is **deprecated** and no longer maintained; users should migrate to google-closure-compiler or google-closure-compiler-js. Key differentiator: self-contained (bundles JRE), but outdated compared to official or Java-free alternatives.

npm install closurecompiler
INSTALL
IMPORT
SIG · CLOSURECOMPILER
C
closurecompiler
devopsjavascriptv1.6.1
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.

compile
var ClosureCompiler = require('closurecompiler');
import ClosureCompiler from 'closurecompiler'
CJS only; no default ESM export.
ClosureCompiler.compile
ClosureCompiler.compile(files, options, callback)
ClosureCompiler.compile(files, callback, options)
Second argument must be options object, not callback.
ccjs CLI
ccjs sourceFiles... [options] > output.js
ccjs sourceFiles... --js_output_file output.js
Use shell redirection for output; --js_output_file is not supported.

Demonstrates basic usage: compile a JavaScript file with advanced optimizations and Node.js externs.

var ClosureCompiler = require('closurecompiler'); ClosureCompiler.compile(['input.js'], { compilation_level: 'ADVANCED_OPTIMIZATIONS', warning_level: 'VERBOSE', externs: ['node'] }, function(err, result) { if (err) console.error(err); else console.log(result); });
closure-compiler --version
Debug
Known issues
deprecatedThis package is deprecated. Alternatives: google-closure-compiler, google-closure-compiler-js
fix
Migrate to google-closure-compiler or google-closure-compiler-js
affects: >=1.0.0
gotchaRequires Java runtime; if JRE not found, package may download a bundled OpenJDK ~45MB
fix
Install Java beforehand to avoid the download
affects: >=1.0.0
gotchaOptions are case-insensitive in the API but must be snake_case (not camelCase)
fix
Use compilation_level instead of compilationLevel
affects: >=1.0.0
gotchaThe --js_output_file flag is NOT supported; use shell redirection
fix
Redirect stdout to file: ccjs files > output.js
affects: >=1.0.0
Errors
Common errors & fixes
Error: Could not find any Java installation
No JRE/JDK installed and automatic download failed
fix
Install Java or ensure JAVA_HOME is set
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed
Out of memory during compilation of large codebase
fix
Increase JVM heap via options: -xmx2048m
Error: spawn ENOENT
ccjs command not found or Java not available
fix
Install globally with -g or check Java installation
Upgrade
Version history
1.6.1latest on npm
Audit
Dependencies
closurecompiler-externsoptionalProvides Node.js externs for closure compiler
Agent activity
2 hits · last 30 days
node
2
Resources
closurecompiler — npm install closurecompiler · libregistry