netlify/build

ESLINT error: TypeError: (0 , import_module.createRequire) is not a function at open_api.js:4:

Closed this issue · 2 comments

Describe the bug

I'm using the package to create sites programmatically from a nuxt.js app and I'm getting this error:
TypeError: (0 , import_module.createRequire) is not a function at open_api.js:4:

package versions:
nuxt: 3.6.3
eslint: 8.38.0
netlify: 13.1.10
nvm current: v20.3.1

Can you please provide help with this?

Steps to reproduce

  1. Create Nuxt app.
  2. install npm packages.
  3. Call functions from the utils/netlify file:
import { NetlifyAPI } from "netlify";

const config = useRuntimeConfig();
const api = new NetlifyAPI(config.public.netlify_auth_token);
const client = useSupabaseAuthClient();

export async function createSite(githubUser,siteName: string, repoName: string) {
  await api
    .createSite({
      account_slug: "githubUser",
      body: {
        name: siteName,
        ssl: true,
        repo: {
          provider: "github",
          repo: `${githubUser}/${repoName}`,
          private: true,
          branch: "main",
          cmd: "CI= npm run generate",
          installation_id: config.installation_id,
          dir: "/dist",
        },
        custom_domain: custom_domain.com,
      },
    })
    .then(async (res: any) => {
      await client.auth.updateUser({
        data: { site_id: res.site_id, deployed: true },
      });
      return res;
    })
    .catch(async (err: any) => {
      await client.auth.updateUser({ data: { deployed: false } });
      return err;
    });
}

export async function getSite(siteId: string) {
  return await api
    .getSite({
      site_id: siteId,
    })
    .then((res: any) => {
      return res;
    })
    .catch((err: any) => {
      return err;
    });
}

Configuration

No response

Deploy logs

Can not create a deploy.

This issue has been automatically marked as stale because it has not had activity in 1 year. It will be closed in 14 days if no further activity occurs. Thanks!

This issue was closed because it had no activity for over 1 year.