Search code examples
node.jstypescriptjirajira-rest-apideno

Deno keeps giving me the same type of error on different modules


I am trying to connect with the Jira REST api using Deno. My Library of choice is Jira.js. I've used both installing the node_modules locally and referencing the modules through the library link. To no avail, deno gives me the same type of error.

error

This is my code.

//import { Version2Client } from "./node_modules/jira.js/src/index.ts";

import * as jira from "https://deno.land/x/jira@v2.10.4/src/index.ts";


const client = new Version2Client({
  host: 'https://FFFFFF.atlassian.net',
  authentication: {
    basic: {
      email: 'FFFFFFF@gmail.com',
      apiToken: 'FFFFFFFF',
    },
  },
});


async function main() {
  const projects = await client.projects.getAllProjects();

  console.log(projects);
}

main();

Solution

  • jira.js does not support Deno directly. But you can run it with NPM compatibility mode, for that, you'll need to replace your import to use npm: specifier: npm:jira.js

    import { Version2Client } from 'npm:jira.js';
    
    const client = new Version2Client({
      host: 'https://FFFFFF.atlassian.net',
      authentication: {
        basic: {
          email: 'FFFFFFF@gmail.com',
          apiToken: 'FFFFFFFF',
        },
      },
    });
    
    // ...