npm executable script error: 'node:process' does not provide an export named 'execPath'
Hi there! I'm testing Deno's ability to directly execute npm packages with bin entries ( https://docs.deno.com/runtime/reference/npm/ ). In particular, I'm testing it against likec4 ( https://www.npmjs.com/package/likec4 ). The LikeC4 CLI ( https://likec4.dev/tooling/cli/ ) offers commands to build, serve, export, etc. The ordinary way it's recommended for use is either via an npm local install or using npx.
On paper, it seems like a command like
deno run --allow-read --allow-write npm:likec4 export png -o ./
should work. However, it throws with the error message Uncaught SyntaxError: The requested module 'node:process' does not provide an export named 'execPath'
. I've attempted to search through the deno documentation, Twitter, and the web for anything relevant. I see that Deno includes a process.execPath property, but I can't figure out how it could be used in the context of an executable script.
I'd appreciate any help or insight anyone could offer. My use case isn't mission critical, it's just a personally relevant example I'm using to learn more about what Deno is capable of. If you would like to try reproducing the error, create a directory with a .c4 file in it (ex: ./example.c4). Within that file, you can paste in a sample LikeC4 definition, such as this one: https://playground.likec4.dev/w/bigbank/ . Finally, with your command line scoped to that directory, run the command I shared previously: deno run --allow-read --allow-write npm:likec4 export png -o ./
Thank you! Lots of love for Deno.npm
likec4
Latest version: 1.10.1, last published: 14 hours ago. Start using likec4 in your project by running
npm i likec4
. There are no other projects in the npm registry using likec4.1 Reply
I just tested this using the Deno 2.0 release candidate and it works perfectly fine! Likely due to the addition of the
process
global in 2.0. Posting this here in case anyone has a similar issue in the future. Thank you, Deno team!