You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just try to use node-hue-api in Deno. And I see that it yield in ERR_UNSUPPORTED_DIR_IMPORT. Seems like it is due to the the way how .js/.ts/.mjs extension are handled in the file. Is there a way to pass --experimental-specifier-resolution=node to import to fix this.
deno install npm:node-hue-api
main.ts file: import * as hue from 'npm:node-hue-api'
deno run main.ts
Got the following errors from the console.
error: [ERR_UNSUPPORTED_DIR_IMPORT] Directory import 'file:///<project_dir>/node_modules/.deno/[email protected]/node_modules/node-hue-api/dist/esm/api/discovery' is not supported resolving ES modules imported from 'file:///<project_dir>/node_modules/.deno/[email protected]/node_modules/node-hue-api/dist/esm/index.js'
The text was updated successfully, but these errors were encountered:
Looking at the code they ship in the node-hue-api package it seems like they're distributing files in ESM syntax, but expect CommonJS resolution. The same error is thrown when you try to import that package in Node with ESM.
node:internal/modules/esm/resolve:259thrownewERR_UNSUPPORTED_DIR_IMPORT(path,fileURLToPath(base),String(resolved));^Error[ERR_UNSUPPORTED_DIR_IMPORT]: Directoryimport'/<project>/node_modules/node-hue-api/dist/esm/api/discovery'isnotsupportedresolvingESmodulesimportedfrom/<project>/node_modules/node-hue-api/dist/esm/index.js
at finalizeResolution (node:internal/modules/esm/resolve:259:11)
at moduleResolve (node:internal/modules/esm/resolve:933:10)
at defaultResolve (node:internal/modules/esm/resolve:1169:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:383:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:352:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:227:38)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:87:39)
at link (node:internal/modules/esm/module_job:86:36) {code: 'ERR_UNSUPPORTED_DIR_IMPORT',url: 'file:///<project>/node_modules/node-hue-api/dist/esm/api/discovery'}
It's an unfortunate situation, because the package say that they support ESM, but it turns out that they do not. They have an issue for that in their tracker already peter-murray/node-hue-api#220
Version: Deno 2.0.2
Just try to use node-hue-api in Deno. And I see that it yield in ERR_UNSUPPORTED_DIR_IMPORT. Seems like it is due to the the way how .js/.ts/.mjs extension are handled in the file. Is there a way to pass --experimental-specifier-resolution=node to import to fix this.
deno install npm:node-hue-api
main.ts
file:import * as hue from 'npm:node-hue-api'
deno run main.ts
Got the following errors from the console.
error: [ERR_UNSUPPORTED_DIR_IMPORT] Directory import 'file:///<project_dir>/node_modules/.deno/[email protected]/node_modules/node-hue-api/dist/esm/api/discovery' is not supported resolving ES modules imported from 'file:///<project_dir>/node_modules/.deno/[email protected]/node_modules/node-hue-api/dist/esm/index.js'
The text was updated successfully, but these errors were encountered: