parcel-bundler / lightningcss

An extremely fast CSS parser, transformer, bundler, and minifier written in Rust.
https://lightningcss.dev
Mozilla Public License 2.0
6.55k stars 190 forks source link

CLI error `This: command not found` #757

Open splashsky opened 5 months ago

splashsky commented 5 months ago

I've installed lightningcss-cli globally for Node, for Bun, and even copied the binary from those directly to /usr/local/bin. Whenever I to execute the lightningcss binary, I get this error: /home/sky/.bun/bin/lightningcss: line 1: This: command not found I'm not sure what other steps to take, but I'd like to be able to use the project.

trymeouteh commented 3 months ago

I get this for an error when I install LightningCSS globally and try to use it in the terminal on Linux Mint.

$ sudo npm i -g lightningcss
$ lightningcss
lightningcss: command not found
$ 

I even tried to restart my computer and the lightningcss command still does not work.

LightningCSS does work when installed as a local dev package in your workspace folder and is accessible using npm scripts, but I would like to be able to use this globally as you can use other tools globally like Rollup when you install Rollup as a global npm package.

DylanPiercey commented 2 months ago

@trymeouteh I'm unsure about OP but for your issue I think you're installing the wrong package, it should be npm i -g lightningcss-cli.

collindutrow commented 1 month ago

I experienced this today using bun.sh via macOS 15. The problem is that no binary is being created. $HOME/.bun/bin/lightningcss is a symlink to ~/.bun/install/global/node_modules/lightningcss-cli/lightningcss which is a text file that contains "This file is required so that npm creates the lightningcss binary on Windows." whereas using npm to install lightningcss-cli seems to do so via brew.

The text is coming from here: https://github.com/parcel-bundler/lightningcss/blob/eb49015cf887ae720b80a2856ccbdf61bf940ef1/cli/lightningcss

Attempting to run this file (which is executable) via Zsh will produce lightningcss: line 1: This: command not found