Issue: Unable to Run Project Locally or Deploy to Vercel Due to Multiple Dependency and Build Errors


Issue: Unable to Run Project Locally or Deploy to Vercel Due to Multiple Dependency and Build Errors

Summary

I’m experiencing multiple blocking issues trying to run the Deriv app locally and deploy it to Vercel. Despite following the project documentation, I encounter Node.js version conflicts, dependency resolution errors, and TypeScript compilation failures.

Environment

  • Local OS: Ubuntu 24.04

  • Node.js: Tried both v18.20.8 and v24.11.1

  • npm: v10.8.2 (with Node 18) / v11.6.2 (with Node 24)

  • Project: Cloned the deriv-app repository

Current Status

I’ve successfully installed Node 18.20.8 as required by the project dependencies, but continue to encounter critical errors when trying to run or build the application.

Detailed Problems Encountered

1. Vercel Deployment Failure

Error: Node.js Version "18.x" is discontinued and must be upgraded. Please set "engines": { "node": "24.x" } in your `package.json` file

Attempted Fix: Updated package.json to specify Node 24, but this conflicts with local requirements.

2. Local Dependency Conflicts

When running npm install with Node 18:

  • EBADENGINE warnings for @deriv-com/analytics@1.4.13 requiring npm 9.x (I have npm 10.8.2)

  • Multiple deprecated package warnings

  • Peer dependency conflicts with postcss versions

3. Missing Development Script

npm error Missing script: "dev"

The documentation mentions npm run serve but the exact way to start development servers is unclear.

4. TypeScript Compilation Error

When attempting to run the bot-web-ui:

TSError: ⨯ Unable to compile TypeScript:
../../../../../../usr/share/nodejs/commander/lib/error.js(37,43): error TS2345: 
Argument of type 'string | undefined' is not assignable to parameter of type 'string'.

This appears to be a compatibility issue between TypeScript and the commander library.

5. Monorepo Script Confusion

Running npm run start attempts to start all 26+ packages, many of which fail due to missing scripts or test configurations.

Steps I’ve Taken

  1. Followed Quick Start Guide:

    • Cloned the deriv-app repository

    • Ran npm run bootstrap

    • Attempted npm run build:all

  2. Tried Multiple Node Versions:

    • Node 24.11.1 (for Vercel compatibility)

    • Node 18.20.8 (for local dependency compatibility)

  3. Attempted Various Start Methods:

    npm run serve core
    npx nx run @deriv/bot-web-ui:serve
    cd packages/bot-web-ui && npm run serve
    
  4. Cleaned and Reinstalled:

    • Multiple rm -rf node_modules and npm install --legacy-peer-deps

    • Cleared npm and ts-node caches

Specific Questions

  1. Node Version Confusion: The project dependencies require Node 18.x, but Vercel rejects Node 18. What’s the recommended approach for deployment?

  2. Running bot-web-ui Independently: Is it possible to run the bot-web-ui package alone, without starting the entire monorepo? If so, what are the exact steps to set it up and run it locally? The documentation mentions running npm run serve bot-web-ui alongside npm run serve core, but I’m encountering TypeScript errors when attempting this.

  3. TypeScript Error: How should I resolve the commander library TypeScript compatibility issue that prevents webpack from starting?

  4. Vercel Deployment: Are there specific configuration files needed for deploying a monorepo to Vercel? What adjustments are required to the vercel.json or build settings?

  5. Integration with Existing Next.js Project: I’m considering integrating the bot-web-ui (or its components) into an existing Next.js application. Is it feasible to:

    • Merge the bot-web-ui functionality into a single Next.js codebase (not as a monorepo)?

    • Use the @deriv/components package directly in a Next.js application?

    Or would I need to run two separate applications and have them communicate? What is the recommended approach for integrating the Deriv bot interface into another application?

Current Error Logs

When Trying to Serve bot-web-ui:

> npx nx run @deriv/bot-web-ui:serve
> @deriv/bot-web-ui@1.0.0 serve
> echo "Serving..." && NODE_OPTIONS='-r ts-node/register' webpack --progress --watch
Serving...
/home/el/Documents/deriv-app/node_modules/ts-node/src/index.ts:859
    return new TSError(diagnosticText, diagnosticCodes, diagnostics);
           ^
TSError: ⨯ Unable to compile TypeScript:
../../../../../../usr/share/nodejs/commander/lib/error.js(37,43): error TS2345: 
Argument of type 'string | undefined' is not assignable to parameter of type 'string'.

When Running npm install:

Multiple warnings about:

  • Unsupported engine for @deriv-com/analytics

  • 48 vulnerabilities (40 moderate, 8 high)

  • Numerous deprecated packages

Configuration Files Present

  • nx.json (Nx workspace configuration)

  • lerna.json (monorepo management)

  • vercel.json (basic Vercel config)

  • Multiple TypeScript configurations

Request for Help

Could someone please provide:

  1. Clear, step-by-step instructions for running the bot-web-ui locally

  2. Guidance on resolving the TypeScript/commander compatibility issue

  3. Best practices for deploying this monorepo to Vercel

  4. Clarification on whether bot-web-ui can run independently and how

  5. Advice on integrating with an existing Next.js application vs. maintaining separate applications

I’m happy to test any suggested solutions and provide additional information as needed.