TJBlackman
TJBlackman2y ago

How can I get `npm` in the path for Deno.run()?

I'm writing a script to automate a tedious npm task that I run frequently. When I use Deno.run() it says that it can't find the program (see the screenshot). How can I get the npm executable in the scope of the Deno process? I'm using: - Windows 10 - Deno v1.29.4 - Npm v8.19.2 - npm path C:\Program Files\nodejs Bonus: I saw something about Deno.Command on another post, and I'm wondering if I should use that, and if so, where I can read about it's API. Thanks!
5 Replies
ioB
ioB2y ago
Try using Deno.command, yeah. The docs are at https://deno.land/api@v1.29.4?unstable=&s=Deno.Command. It's a bit unfortunate that we don't have a https://examples.deno.land about this, will open a PR soon.
Deno by Example
Deno by example is a collection of annotated examples for how to use Deno, and the various features it provides.
TJBlackman
TJBlackmanOP2y ago
Same error!
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
TJBlackman
TJBlackmanOP2y ago
Same error. Uncaught NotFound: program not found I don't think npm is in scope - so to speak. Maybe if I use the complete executable path...
TJBlackman
TJBlackmanOP2y ago
Got it! Thanks for everyone's help.