Schmuki
Schmuki
DDeno
Created by Schmuki on 12/10/2023 in #help
Importing NPM Packages in Deno Throws 'Uncaught SyntaxError' for Specific Modules
Hi there, I'm relatively new to Deno. I'm running into an error with an NPM package import.
import { BskyAgent } from "npm:@atproto/api";

const agent = new BskyAgent({
/* Agent options */
});
import { BskyAgent } from "npm:@atproto/api";

const agent = new BskyAgent({
/* Agent options */
});
error: Uncaught SyntaxError: The requested module 'npm:@atproto/api' does not provide an export named 'BskyAgent'
import { BskyAgent } from "npm:@atproto/api";
^
at <anonymous> (file:///Users/<username>/Desktop/deno/main.ts:1:10)
Watcher Process failed. Restarting on file change...
error: Uncaught SyntaxError: The requested module 'npm:@atproto/api' does not provide an export named 'BskyAgent'
import { BskyAgent } from "npm:@atproto/api";
^
at <anonymous> (file:///Users/<username>/Desktop/deno/main.ts:1:10)
Watcher Process failed. Restarting on file change...
The code works fine with NodeJS. I've tried using Deno run with the --unstable flag but got the same error message. I've also tried other packages (express for example) which worked just fine. Am I doing something wrong here? Do I need to configure something to get the package to work with Deno?
3 replies