Error running program that uses `fp-ts` from npm (`Is a directory (os error 21)`)
https://github.com/Industrial/test-fp-ls/blob/main/mod.ts
When I run
deno run -A mod.ts
I get:
Is my import_map.json
wrong? https://github.com/Industrial/test-fp-ls/blob/main/import_map.jsonGitHub
test-fp-ls/mod.ts at main · Industrial/test-fp-ls
Contribute to Industrial/test-fp-ls development by creating an account on GitHub.
GitHub
test-fp-ls/import_map.json at main · Industrial/test-fp-ls
Contribute to Industrial/test-fp-ls development by creating an account on GitHub.
2 Replies
It works with esm.sh
I would rather use
npm:
going forward, seeing as it works on deno deploy now.Based on the documentation, the error message you're seeing typically indicates that Deno is trying to import a directory instead of a file. This could be due to how the
fp-ts
package is structured or how it's being referenced in your import_map.json
.
In your import_map.json
, you have:
This maps the fp-ts
import to the URL https://cdn.skypack.dev/fp-ts@2.16.1
, which is a directory. Deno expects to import a specific file, not a directory.
You might need to specify the exact file in the fp-ts
package that you want to import. For example, if you wanted to import the Option
module from fp-ts
, your import map might look like this:
Then in your mod.ts
file, you would import the Option
module like this:
Please note that the exact URL and import statement might differ based on the structure of the fp-ts
package. You'll need to adjust them to match the actual structure of the package.
If you continue to experience issues, it might be helpful to check if fp-ts
has specific instructions for usage with Deno, or consider reaching out to the fp-ts
maintainers for