Registry / devops / google-closure-compiler-osx

google-closure-compiler-osx

JSON →
library20240317.0.0jsnpmunverified

The OS X native binary distribution of Google's Closure Compiler, a JavaScript optimization and type-checking tool. This package provides the compiler via a Java binary specifically for macOS. Current stable version: 20240317.0.0. Releases follow upstream Closure Compiler releases, typically monthly. This is the platform-specific variant for macOS; equivalent packages exist for linux, windows, and a Java-based generic one. Key differentiator: optimized native binary for macOS vs running via Java.

npm install google-closure-compiler-osx
INSTALL
IMPORT
SIG · GOOGLE-CLOSURE-COM
G
google-closure-compiler-osx
devopsjavascriptv20240317.0.0
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.

getNativeImagePath
import { getNativeImagePath } from 'google-closure-compiler-osx'
const getNativeImagePath = require('google-closure-compiler-osx').getNativeImagePath
ESM only; no default export.
platform
const platform = require('google-closure-compiler-osx')
import platform from 'google-closure-compiler-osx'
CommonJS fallback; ESM preferred but platform is the default export in CJS.
binaryPath
import { binaryPath } from 'google-closure-compiler-osx'
Exposed as a string path to the native binary.

Shows how to use the Google Closure Compiler native binary for macOS to minify a JavaScript file using simple optimizations.

const { exec } = require('child_process'); const path = require('path'); const cc = require('google-closure-compiler-osx'); const compilerPath = cc.binaryPath; // Compile a simple JavaScript file const child = exec(`${compilerPath} --compilation_level SIMPLE_OPTIMIZATIONS --js input.js --js_output_file output.min.js`); child.stdout.on('data', (data) => console.log(data)); child.stderr.on('data', (data) => console.error(data));
google-closure-compiler --version
Debug
Known issues
gotchaThe native binary may require Rosetta 2 on Apple Silicon Macs for versions before 2023.
fix
Update to version >=20230501 or use the Java fallback via google-closure-compiler-java.
affects: <20230501
gotchaThe package is platform-specific; installing on non-macOS will fail or fallback to Java.
fix
Use google-closure-compiler-linux or google-closure-compiler-windows for other platforms.
affects: all
breakingSwitched from bundled Java to native binary in v20201001. Old versions were Java-based requiring JRE.
fix
Upgrade to >=20201001 or ensure JRE is installed if using older versions.
affects: <20201001
Errors
Common errors & fixes
Error: Cannot find module 'google-closure-compiler-osx'
Package not installed or not available on this platform
fix
Install with npm install google-closure-compiler-osx --save-dev
Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.io.FileNotFoundException: /path/to/input.js
Input file path is incorrect or missing
fix
Check that input file exists and path is absolute or correctly relative.
WARNING: -Dfile.encoding=UTF-8 not supported
Encoding flag not supported on native binary
fix
Remove the -Dfile.encoding=UTF-8 flag from your command.
Upgrade
Version history
20240317.0.0latest on npm
Audit
Dependencies
google-closure-compiler-javaoptionalThe Java-based fallback if native binary fails
Agent activity
6 hits · last 30 days
node
6
Resources
google-closure-compiler-osx — npm install google-closure-compiler-osx · libregistry