dsm23
dsm2315mo ago

deno compile -A npm:cowsay not working

Hello, I am trying deno compile -A npm:cowsay and then following that with ./cowsay Hello World! but the result is:
error: Failed caching npm package 'cowsay@1.5.0'.

Caused by:
An npm specifier not found in cache: "cowsay", --cached-only is specified.
error: Failed caching npm package 'cowsay@1.5.0'.

Caused by:
An npm specifier not found in cache: "cowsay", --cached-only is specified.
Is there something I'm missing? I'm currently on macOS. Deno version 1.36.4
9 Replies
Deno AI Helper
Deno AI Helper15mo ago
I'm sorry to hear that you're having trouble with deno compile. Based on the documentation, it seems like you might be missing a step. Before you can compile the npm package, you need to cache it first. You can do this by running deno cache --unstable npm:cowsay@1.5.0. This will download the package information and resolved versions of the package to Deno’s global npm cache. After you've cached the package, you should be able to compile it with deno compile -A npm:cowsay@1.5.0. Please give this a try and let me know if you're still encountering issues. 🦕
dsm23
dsm23OP15mo ago
Same error
lcasdev
lcasdev15mo ago
cc @dsherret @dsm23 can you open an issue on the Deno repo? we will investigate further there
dsherret
dsherret15mo ago
@dsm23 strange. This works for me on both windows and linux without caching. Would you be able to open an issue? what does the directory look like that you're running this command in? (ex. do you have a package.json, deno.json with config, and what does the path look like)
leftdev
leftdev15mo ago
i don't remember 100%, but i had a similar experience not too long ago. I believe all npm: packages had to be installed via npm to be able to deno compile. is that expected behaviour? since i have a package.json i just ran npm i and it worked fine from then on. i don't think i even have npm: deps on that project anymore
dsherret
dsherret15mo ago
yeah, i just reproduced it thanks!
leftdev
leftdev15mo ago
i'm guessing that means it's not expected behaviour :p no prob
dsherret
dsherret15mo ago
yeah, it's not expected
dsherret
dsherret15mo ago
GitHub
deno compile fails if run in folder with package.json and uninstall...
cat package.json { "dependencies": { "node-fetch": "^3.3.2" } } > rm -rf node_modules > deno compile -A npm:cowsay > ./cowsay error: Failed caching npm p...