error: Uncaught (in promise) Error: Cannot find module 'util'
Require stack:
- /Users/dd/Library/Caches/deno/npm/registry.npmjs.org/sharp/0.31.1/lib/constructor.js
- /Users/dd/Library/Caches/deno/npm/registry.npmjs.org/sharp/0.31.1/lib/index.js
- /Users/dd/Library/Caches/deno/npm/registry.npmjs.org/sharp/0.31.1/lib/index.js
at Function.Module._resolveFilename (deno:ext/node/02_require.js:615:17)
at Function.Module._load (deno:ext/node/02_require.js:447:29)
at Module.require (deno:ext/node/02_require.js:658:21)
at require (deno:ext/node/02_require.js:789:18)
at Object.<anonymous> (file:///Users/dd/Library/Caches/deno/npm/registry.npmjs.org/sharp/0.31.1/lib/constructor.js:3:14)
at Object.<anonymous> (file:///Users/dd/Library/Caches/deno/npm/registry.npmjs.org/sharp/0.31.1/lib/constructor.js:425:4)
at Module._compile (deno:ext/node/02_require.js:719:36)
at Object.Module._extensions..js (deno:ext/node/02_require.js:752:12)
at Module.load (deno:ext/node/02_require.js:636:34)
at Function.Module._load (deno:ext/node/02_require.js:493:14)
Watcher Process finished. Restarting on file change...
Env
Run the code:
import sharp from 'npm:sharp';
And throw exception:
Then find the keyword in the sharp package:
Expected
Resolve the node dependencies.
Additional Info
If I remove the util line, there is the same error with the stream package:
error: Uncaught (in promise) Error: Cannot find module 'stream'
Also, the following alternative is not working:
import sharp from "https://esm.sh/sharp@0.31.1";
with error: