5 ms·
Thank you. I have just started with node, so your advice is valuable. Do you know if files with '#!/bin/node' (or was it '#!/bin/env/node') work in windows when
by importMe 14y ago
Thank you. I have just started with node, so your advice is valuable. Do you know if files with '#!/bin/node' (or was it '#!/bin/env/node') work in windows when published through npm?
- niggler 14y agoI haven't tried in windows, but the recommended way to handle binaries is through the `bin` field in package.json (and this technique doesn't care about the shebang because it doesn't run the script directly using the OS). For example, in the `xlsx` module: "bin": { "xlsx2csv": "./bin/xlsx2csv.njs" }, https://github.com/Niggler/js-xlsx/blob/master/package.json#L9-L11 https://github.com/Niggler/js-xlsx/blob/master/package.json#... Relevant doc: https://npmjs.org/doc/json.html#bin https://npmjs.org/doc/json.html#bin
- importMe 14y agoThanks, I'll take a look at that.
- kodablah 14y agoIf you specify a js file as an executable file in your package.json, npm wraps it in a .cmd file on Windows just like it wraps it in a shell file on nix.
- importMe 14y agoThat's good to know. Thanks!