Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error messages for naively used packages #24699

Closed
rbetts opened this issue Jul 24, 2024 · 1 comment · Fixed by #25430
Closed

Improve error messages for naively used packages #24699

rbetts opened this issue Jul 24, 2024 · 1 comment · Fixed by #25430
Labels
bug Something isn't working correctly
Milestone

Comments

@rbetts
Copy link

rbetts commented Jul 24, 2024

Examples like "https://jsr.io/@std/dotenv/doc/~/load#example_1..." don't work out of the box and give error messages with insufficient guidance:

 error: Relative import path "@std/dotenv/load" not prefixed with / or ./ or ../
    at file:///Users/rbetts/code/test-env/hello.ts:2:8

We should improve the CLI error message to tell people how to resolve the problem ("add the registry specifier or use deno add")?

Further, naively attempting deno add @std/dotenv/load produces a confusing error message that doesn't include guidance:

Created deno.json configuration file.
error: Failed to parse package required: @std/dotenv/load

Caused by:
    0: Invalid package requirement '@std/dotenv/load'. Invalid version requirement. Invalid specifier version requirement. Unexpected character '/'
         /load
         ~
    1: Invalid version requirement. Invalid specifier version requirement. Unexpected character '/'
         /load
         ~
    2: Invalid specifier version requirement. Unexpected character '/'
         /load
         ~
    3: Unexpected character '/'
         /load
         ~
@lucacasonato lucacasonato added the bug Something isn't working correctly label Aug 2, 2024
@lucacasonato lucacasonato added this to the 2.0 milestone Aug 2, 2024
@bartlomieju bartlomieju removed their assignment Sep 3, 2024
@dsherret
Copy link
Member

dsherret commented Sep 3, 2024

Moved out the second point to #25385

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants