lessc runs with "/usr/bin/env node"
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/
throw err;
^
Error: Cannot find module 'tslib'
Require stack:
- /usr/share/
- /usr/share/
at Function.
at Function.
at Module.require (internal/
at require (internal/
at Object.<anonymous> (/usr/share/
at Module._compile (internal/
at Object.
at Module.load (internal/
at Function.
at Module.require (internal/
code: 'MODULE_NOT_FOUND',
requireStack: [
'/usr/
'/usr/
]
}
```
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.