Skip to content

Getting TypeError: Client is not a constructor #175

Description

@justmedev

Describe the bug
When trying to initialize the client like this:

import Client from "nextcloud-node-client";

const client = new Client();

I get:

file:///C:/Users/ilja/Desktop/Projects/Development/Other/Plugins/steam-cloud-sync/nct.js:3
const client = new Client();
               ^

TypeError: Client is not a constructor
    at file:///C:/Users/ilja/Desktop/Projects/Development/Other/Plugins/steam-cloud-sync/nct.js:3:16
    at ModuleJob.run (node:internal/modules/esm/module_job:183:25)
    at async Loader.import (node:internal/modules/esm/loader:178:24)
    at async Object.loadESM (node:internal/process/esm_loader:68:5)
    at async handleMainPromise (node:internal/modules/run_main:63:12)

To Reproduce

  1. Make a new JS/TS file (with the latest node version)
  2. Import and initialize the client constructor

Expected behavior
Client should get initialized without any trouble

Additional context
Tried it with various TS configs and JS EMS syntax

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions