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

Failed to resolve JSON files when using npm specifiers #16118

Closed
kidonng opened this issue Oct 1, 2022 · 2 comments · Fixed by #16125
Closed

Failed to resolve JSON files when using npm specifiers #16118

kidonng opened this issue Oct 1, 2022 · 2 comments · Fixed by #16125
Assignees
Labels
bug Something isn't working correctly node compat

Comments

@kidonng
Copy link
Contributor

kidonng commented Oct 1, 2022

Deno version: 1.26.0

$ deno run -A --unstable npm:xo --help
error: Expected ';', '}' or <eof> at file:///home/codespace/.cache/deno/npm/registry.npmjs.org/globals/13.17.0/globals.json:2:12

According to the README, the globals package contains a plain JSON file and is used by ESLint. The issue seems to be related to JSON resolution (it seems like the resolver treats the JSON as a ES module), but it's just my best guess.

The xo package has a lot of dependencies so it's definitely not a minimal reproduction. Pardon me for not having a better one.

@kidonng kidonng changed the title Error require() JSON files when using npm specifiers Failed to resolve JSON files when using npm specifiers Oct 1, 2022
@bartlomieju bartlomieju added bug Something isn't working correctly node compat labels Oct 1, 2022
@bartlomieju
Copy link
Member

Simpler reproduction:

import globals from "npm:globals";
deno run -A --unstable test.js
error: Expected ';', '}' or <eof> at file:///Users/ib/Library/Caches/deno/npm/registry.npmjs.org/globals/13.17.0/globals.json:2:12

@okikio
Copy link

okikio commented Mar 5, 2023

I'm also running into this issue in Deno 1.31.1

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 node compat
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants