Registry / devops / lightningcss-linux-arm64-gnu

lightningcss-linux-arm64-gnu

JSON →
library1.32.0jsnpmunverified

Lightning CSS is an extremely fast, Rust-based CSS parser, transformer, bundler, and minifier. This specific package, `lightningcss-linux-arm64-gnu` (current stable version `1.32.0`), provides the native aarch64-unknown-linux-gnu build of the core library. It is typically installed as a transitive dependency of the main `lightningcss` package, which dynamically loads the appropriate platform-specific binary. The library differentiates itself by offering exceptional performance (over 100x faster than some JavaScript alternatives), browser-grade parsing based on Mozilla's `cssparser` and `selectors` crates, and comprehensive support for modern CSS features, including transpilation, vendor prefixing, syntax lowering, and CSS Modules, all configurable via browser targets. Releases are frequent, with minor versions often appearing monthly or bi-monthly, reflecting active development. It can be used as a standalone library, a CLI tool, or integrated into build systems like Parcel, which includes it out of the box.

npm install lightningcss-linux-arm64-gnu
INSTALL
IMPORT
SIG · LIGHTNINGCSS-LINUX
L
lightningcss-linux-arm64-gnu
devopsjavascriptv1.32.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

transform
import { transform } from 'lightningcss';
const { transform } = require('lightningcss');
The `lightningcss` library is primarily distributed as an ES Module. While older Node.js versions might tolerate `require()`, modern usage and future compatibility strongly recommend `import`.
bundleAsync
import { bundleAsync } from 'lightningcss';
import { bundle } from 'lightningcss';
`bundleAsync` is preferred for resolving `@import` rules, especially with custom resolvers. The synchronous `bundle` exists but `bundleAsync` is generally more flexible and efficient for I/O operations.
browserslistToTargets, Features
import { browserslistToTargets, Features } from 'lightningcss';
import * as lightningcss from 'lightningcss';
These are named exports for configuring browser compatibility targets and enabling/disabling specific CSS features during transformation.

This quickstart demonstrates how to use `lightningcss` to parse, minify, and transpile CSS code for specific browser targets, including generating source maps and enabling modern CSS drafts like nesting and custom media queries. It also shows a basic custom visitor example.

import { transform, browserslistToTargets } from 'lightningcss'; import browserslist from 'browserslist'; import fs from 'node:fs'; const cssInput = ` :root { --primary-color: oklch(70% 0.1 270); } .container { display: grid; grid-template-areas: "header" "main" "footer"; gap: 1rem; padding: env(--spacing-medium); } .header { background-color: var(--primary-color); color: white; font-size: clamp(1rem, 5vw, 2.5rem); } @media (width <= 768px) { .container { grid-template-areas: "header" "footer" "main"; } } `; // Determine browser targets from a browserslist query for optimal transpilation and prefixing const targets = browserslistToTargets(browserslist('last 2 versions, > 0.5%')); // Transform and minify the CSS try { const { code, map } = transform({ filename: 'input.css', code: Buffer.from(cssInput), minify: true, sourceMap: true, targets, drafts: { nesting: true, // Enable CSS nesting support customMedia: true // Enable custom media query support }, // Example of a custom visitor (optional, but demonstrates advanced usage) visitor: { Rule: { at(rule) { if (rule.name === 'media' && rule.query.value.includes('width <= 768px')) { // Modify or inspect media rules // console.log(`Processing media query: ${rule.query.value}`); } } } } }); console.log('Minified CSS:'); console.log(code.toString()); console.log('\nSource Map (first 100 chars):'); console.log(map.toString().substring(0, 100) + '...'); // Example of writing to a file fs.writeFileSync('output.min.css', code); fs.writeFileSync('output.min.css.map', map); console.log('\nOutput written to output.min.css and output.min.css.map'); } catch (error) { console.error('Error transforming CSS:', error); }
lightningcss --version
Debug
Known issues
breakingIn `v1.30.0`, the parsing of relative colors was updated to align with the latest CSS specification. This change requires `calc()` expressions within relative colors to use numbers instead of percentages. Existing code that uses percentages in these contexts may need to be updated to use number values, which could break styling.
fix
Review relative color calculations, particularly within `calc()` functions. Convert percentage values to numbers where the spec now requires them.
affects: >=1.30.0
gotchaAs a platform-specific native module (`lightningcss-linux-arm64-gnu`), installation can fail if the target system's architecture (ARM64) or libc (GNU) does not match, or if there are issues with Node.js ABI compatibility. While prebuilt binaries reduce the need for `node-gyp`, underlying system differences can still cause installation or runtime failures.
fix
Ensure that the host system's architecture (arm64) and libc (GNU) match the package name. If issues persist, verify Node.js version compatibility and consider installing `lightningcss` directly to let npm/yarn resolve the correct platform-specific binary.
affects: >=1.0.0
gotchaThe `lightningcss` library is typically an ES Module (ESM). Attempting to `require()` it in a CommonJS (CJS) environment can lead to a `ERR_REQUIRE_ESM` error. While Node.js offers interop, CJS `require()` cannot directly load ESM modules.
fix
Prefer `import` statements if your project is ESM-native (`"type": "module"` in `package.json`). If constrained to CJS, use dynamic `import()` (e.g., `const { transform } = await import('lightningcss');`) to load the ESM module asynchronously.
affects: >=1.0.0
gotchaUsers should install the main `lightningcss` package (`npm install lightningcss`), not the platform-specific `lightningcss-linux-arm64-gnu` directly. The main package automatically detects the environment and installs the correct native addon, ensuring broader compatibility and avoiding manual platform targeting.
fix
Always install `lightningcss` as a primary dependency. Only interact with `lightningcss-linux-arm64-gnu` if you are developing against or debugging the native bindings for a specific platform.
affects: >=1.0.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM: require() of ES Module .../node_modules/lightningcss/lib/index.js from ... not supported.
Attempting to use `require('lightningcss')` in a CommonJS module when `lightningcss` is an ES Module.
fix
Switch to ES Module `import { transform } from 'lightningcss';` if your project is ESM. If you must use CommonJS, use dynamic import: `const { transform } = await import('lightningcss');` within an `async` function or at the top level in a module that can handle `await`.
Error: The module '.../node_modules/lightningcss-linux-arm64-gnu/lightningcss.node' was compiled against a different Node.js version. Using Node.js X.Y.Z, expected Z.Y.X.
A Node.js ABI (Application Binary Interface) mismatch. The native addon was compiled for a different Node.js major version or runtime environment than the one currently being used.
fix
Ensure your Node.js version is compatible with the installed `lightningcss` binary. Try updating `lightningcss` to the latest version (`npm update lightningcss`) or reinstalling (`npm rebuild lightningcss` or `npm install --force lightningcss`) to trigger recompilation or download of the correct prebuilt binary for your current Node.js version.
Cannot find module 'lightningcss-linux-arm64-gnu/lightningcss.node'
The native addon binary for `lightningcss` could not be found or loaded. This usually means the `lightningcss` package (or its platform-specific variant) failed to install correctly, or the system architecture/OS is incompatible.
fix
First, ensure `lightningcss` is correctly installed by running `npm install lightningcss`. If the error persists, check your system logs for detailed installation failures. Verify your system matches the `arm64` architecture and `gnu` libc. If running in a Docker container or unusual environment, try explicitly setting `NPM_CONFIG_PLATFORM` and `NPM_CONFIG_ARCH` during installation.
Upgrade
Version history
1.32.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
lightningcss-linux-arm64-gnu — npm install lightningcss-linux-arm64-gnu · libregistry