deno icon indicating copy to clipboard operation
deno copied to clipboard

could not resolve npm package

Open sigmaSd opened this issue 2 years ago • 6 comments
trafficstars

> import * as pl from "npm:@pola-rs/browser"

✅ Granted env access to "NODE_CLUSTER_SCHED_POLICY".
✅ Granted env access to "NODE_UNIQUE_ID".
Uncaught TypeError: Could not resolve 'npm:@pola-rs/browser'.
  Caused by:
    not found
    at async <anonymous>:2:12

but it seems to exist https://www.npmjs.com/package/@pola-rs/browser?activeTab=readme

sigmaSd avatar Jan 14 '23 17:01 sigmaSd

using strace I can see that deno looks for inedx.js but there is only browser.js

statx(AT_FDCWD, "/home/mrcool/.cache/deno/npm/registry.npmjs.org/@pola-rs/browser/0.0.1-alpha/index.js", AT_STATX_SYNC_AS_STAT, STATX_ALL, 0x7ffc31a5f930) = -1 ENOENT (Aucun fichier ou dossier de ce type)

image

If I copy browser.js to index.js I get another error

Deno 1.29.3+1712a88
exit using ctrl+d, ctrl+c, or close()
> import * as pl from "npm:@pola-rs/browser"

error: TypeError: Could not resolve 'https://deno.land/[email protected]/node/module_all.ts' from 'file:///home/mrcool/.cache/deno/npm/registry.npmjs.org/@pola-rs/browser/0.0.1-alpha/[deno:cli/node/mod.rs:412:32]'.
  Caused by:
    [ERR_UNSUPPORTED_ESM_URL_SCHEME] Only file and data URLS are supported by the default ESM loader. Received protocol 'https'
    at async loadBuiltinNodeModules ([deno:cli/node/mod.rs:412:32]:2:25)
>

EDIT: This error is unrelated, it happens because I run deno inside ~/.cache/deno/npm

sigmaSd avatar Jan 14 '23 17:01 sigmaSd

If I copy browser.js to index.js this is the error

Deno 1.29.3+1712a88
exit using ctrl+d, ctrl+c, or close()
> import * as pl from "npm:@pola-rs/browser"

Uncaught TypeError: 'import', and 'export' cannot be used outside of module code at file:///home/mrcool/.cache/deno/npm/registry.npmjs.org/@pola-rs/browser/0.0.1-alpha/index.js:1:1

  import { startWorkers } from './snippets/wasm-bindgen-rayon-7afa899f36665473/src...
  ~~~~~~
    at async <anonymous>:2:12
>

sigmaSd avatar Jan 14 '23 18:01 sigmaSd

i got same error with @hono/zod-openapi image

popuguytheparrot avatar Oct 03 '23 10:10 popuguytheparrot

TypeError: Could not resolve 'npm:@material/[email protected]'.
  Caused by:
    not found

same here

RoXuS avatar Oct 12 '23 13:10 RoXuS

Curiously I only see this problem on less-common npm packages, like one of my own published npm modules.

error: Could not resolve 'npm:[email protected]'.
Caused by:
    not found

I had no problem with a more popular module such as date-fns

import { isBefore } from 'npm:date-fns'; // this works

Is there any fix for this, or anything I can do to help find a solution?

insanity54 avatar Dec 01 '23 16:12 insanity54

I'm experiencing the same issue with a package I published recently:

error: Could not resolve 'npm:[email protected]'.

Caused by:
    not found

npm install tana-to-json works fine as expected

nbbaier avatar Feb 03 '24 18:02 nbbaier

import * as pl from "npm:@pola-rs/browser";

doesn't error anymore but adding console.log(pl); it errors with Not found

sigmaSd avatar Mar 30 '24 10:03 sigmaSd