Openvidu-node-client build failing

Hello,

I’m facing an issue while building my app server that integrates the openvidu-node-client SDK.

Environment:

  • Node: v14.19.1
  • typescript: “^3.9.10”
  • openvidu-node-client: “2.29.0”

Situation: On my local machine, the server runs fine. I can connect to it, mint tokens, and manage sessions without any problems. However, the issue arises when I attempt to build my app for deployment.

Error: While executing tsc --project ./tsconfig.build.json , I encounter multiple errors, like this:

nps is executing `transpile` : tsc --project ./tsconfig.build.json
node_modules/openvidu-node-client/node_modules/axios/index.d.ts:9:18 - error TS1005: ']' expected.
9   [Key in Method as Lowercase<Key>]: AxiosHeaders;

node_modules/openvidu-node-client/node_modules/axios/index.d.ts:9:21 - error TS1005: ';' expected.

9   [Key in Method as Lowercase<Key>]: AxiosHeaders;

Here is my tsconfig.json::

{
    "compilerOptions": {
        "target": "es6",
        "module": "commonjs",
        "pretty": true,
        "sourceMap": true,
        "outDir": "dist",
        "importHelpers": true,
        "strict": true,
        "noImplicitAny": false,
        "strictNullChecks": false,
        "noImplicitThis": true,
        "alwaysStrict": true,
        "noUnusedLocals": true,
        "noUnusedParameters": false,
        "noImplicitReturns": true,
        "noFallthroughCasesInSwitch": true,
        "moduleResolution": "node",
        "baseUrl": ".",
        "allowSyntheticDefaultImports": true,
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "resolveJsonModule": true,
        "esModuleInterop": true,
        "skipLibCheck": true,
        "lib": [
            "es5",
            "es6",
            "dom",
            "es2015.core",
            "es2015.collection",
            "es2015.generator",
            "es2015.iterable",
            "es2015.promise",
            "es2015.proxy",
            "es2015.reflect",
            "es2015.symbol",
            "es2015.symbol.wellknown",
            "esnext.asynciterable",
            "ES2020.Promise"
        ]
    }
}

I’ve been using numerous npm packages in various projects and haven’t come across an issue like this one. Any guidance or suggestions to resolve this would be highly appreciated.

Thank you for your time and assistance!

Kind regards,
Marin

I think this could be a TypeScript issue, as openvidu-node-client is using 4.9.3 and your project 3.9.10.
Actually, with a quick search online the problem must be precisely that: recent versions of axios do not compile with such and old version of typescript (TypeError: ']' expected (v1.1.0) · Issue #5039 · axios/axios · GitHub). I would simply upgrade my TypeScript version to a more recent one.

That was it, thanks! Upgrading TypeScript to 4.9.3 solved my issues.