lessc runs with "/usr/bin/env node"

Bug #1990049 reported by Tom Most
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
less.js (Ubuntu)
New
Undecided
Unassigned

Bug Description

The `/usr/bin/lessc` executable installed by the node-less package has a shbang of `#!/usr/bin/env node`. This causes it to pick up on any `node` executable that is earlier on PATH. In my case that's one installed by nvm that doesn't look for packages in the `/usr/share/nodejs` directory that contains the dependencies of `lessc`, such as `tslib`. This results in a traceback like:

```
❯ lessc
internal/modules/cjs/loader.js:797
    throw err;
    ^

Error: Cannot find module 'tslib'
Require stack:
- /usr/share/nodejs/less/lib/less/utils.js
- /usr/share/nodejs/less/bin/lessc
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/usr/share/nodejs/less/lib/less/utils.js:3:15)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/share/nodejs/less/lib/less/utils.js',
    '/usr/share/nodejs/less/bin/lessc'
  ]
}
```

Proposed solution: `lessc` should have a shbang of `#!/usr/bin/node` so that it runs with a `node` that looks for the packaged dependencies.

Workaround: Use `/usr/bin/node /usr/bin/lessc` instead of running `lessc` directly.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.