denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
97.15k stars 5.36k forks source link

Show hint when trying to install a package globally without a `:npm`/`:jsr` prefix #26545

Open dmint789 opened 5 days ago

dmint789 commented 5 days ago

When I try to install a package globally without specifying the source (e.g. deno install -g concurrently), it throws this error: 'error: Module not found "/path/to/current/dir/package_name"'. Instead, it should show the same type of hint as deno add [package without a source specifier] (e.g. error: concurrently is missing a prefix. Did you mean deno add npm:concurrently?).

bartlomieju commented 4 days ago

Good idea, it's a "Good first issue" if someone is interested in implementing it. You can start by looking at install_global function in cli/tools/installer.rs and following what install_local is doing to figure out if a prefix should be added.

SatanshuMishra commented 4 days ago

This would be my first PR but I am happy to give it a try if that's alright!

bartlomieju commented 4 days ago

@SatanshuMishra please do