CLI script in node_modules/.bin is broken
gwenya opened this issue · 5 comments
The node_modules/.bin/tspegjs
script does not start with #!/usr/bin/env node
, so running it directly from the shell results in unexpectedly calling the import
program with parameters * as fs from "node:fs"
.
I would also admit that described event is happening in one of my maintained repositories. NPM scripts involving usage of tspegjs
are not usable due to stated issue.
It sounds like node is trying to execute the code as commonjs
instead of esm
. Perhaps this could be solved by adding --input-type=module
to the pragma? https://nodejs.org/api/packages.html#--input-type-flag
I can’t quite imagine how the missing shebang line has anything to do with commonjs or esm.
npm creating it, right?
How we can influence it to add the missing shebang?