Skip to content

deno doc command failed to resolve npm package #33033

@mrduguo

Description

@mrduguo

Version: deno 2.7.8 (stable, release, aarch64-apple-darwin)

I have a simple ts file: doc-with-debug-package.ts

import Debug from 'npm:[email protected]'
const debug = Debug('bug-report')
debug('hi')

When I run with deno doc --json doc-with-debug-package.ts, failed with error:

Warning Failed resolving types. Could not resolve 'npm:[email protected]'
    0: [ERR_TYPES_NOT_FOUND] Could not find types for 'file:///Users/***/Library/Caches/deno/npm/registry.npmjs.org/debug/4.4.0/index.js' imported from 'file:///Users/***/doc-with-debug-package.ts'
    at file:///Users/***/doc-with-debug-package.ts:2:19
error: Failed resolving 'npm:[email protected]' from 'file:///Users/***/doc-with-debug-package.ts'.

The referenced file exists at file:///Users/***/Library/Caches/deno/npm/registry.npmjs.org/debug/4.4.0/src/index.js, so seems the command didn't read main: ./src/index.js from the package.json

It works with deno 2.6.4 (stable, release, aarch64-apple-darwin)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions