Skip to content

Error: Cannot find module 'lzma-purejs-requirejs' #214

@pepew-le-boss

Description

@pepew-le-boss

I'm on a brand new nextjs project. When I try to use the library, I have this error:

Error: Cannot find module 'lzma-purejs-requirejs'

Example:

import { getHistoricalRates } from "dukascopy-node"
import { Chart } from "@/components/client/common/Chart"
import { tryCatch } from "@/utils/try-catch.utils"

export async function Dukascopie() {
  const { data, error } = await tryCatch(
    getHistoricalRates({
      instrument: "eurusd",
      dates: {
        from: new Date("2025-01-01"),
        to: new Date("2025-02-01"),
      },
      timeframe: "d1",
      format: "json",
    }),
  )

  if (error) {
    return <div>Error: {error.message}</div>
  }

  return (
    <div>
      <Chart data={data} />
    </div>
  )
}

I fixed it doing this import instead:

import { getHistoricalRates } from "dukascopy-node/dist/index.js"

It works, but is this a normal behavior?

  

Also in my dev console I keep seeing this log every time a page is load:

⚠ ./node_modules/.pnpm/fastest-validator@1.10.0/node_modules/fastest-validator/lib/helpers/prettier.js
Critical dependency: the request of a dependency is an expression

Import trace for requested module:
./node_modules/.pnpm/fastest-validator@1.10.0/node_modules/fastest-validator/lib/helpers/prettier.js
./node_modules/.pnpm/fastest-validator@1.10.0/node_modules/fastest-validator/lib/validator.js
./node_modules/.pnpm/fastest-validator@1.10.0/node_modules/fastest-validator/index.js
./node_modules/.pnpm/dukascopy-node@1.43.0/node_modules/dukascopy-node/dist/index.js
./src/components/server/feature/data/Dukascopie.tsx
./src/app/page.tsx

Do you have a fix for this one? Wasn't able to find one.

  

Here's my package.json if needed:

{
  "name": "tradingz",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "dayjs": "^1.11.13",
    "dukascopy-node": "^1.43.0",
    "lightweight-charts": "^5.0.8",
    "next": "15.2.4",
    "react": "^19.0.0",
    "react-dom": "^19.0.0"
  },
  "devDependencies": {
    "@eslint/eslintrc": "^3",
    "@next/eslint-plugin-next": "^15.2.3",
    "@tailwindcss/postcss": "^4",
    "@types/node": "^20",
    "@types/react": "^19",
    "@types/react-dom": "^19",
    "eslint": "^9",
    "eslint-config-next": "15.2.2",
    "eslint-config-prettier": "^10.1.1",
    "eslint-plugin-prettier": "^5.2.6",
    "eslint-plugin-react-hooks": "^5.2.0",
    "eslint-plugin-simple-import-sort": "^12.1.1",
    "postcss": "^8.5.3",
    "prettier": "^3.5.3",
    "prettier-plugin-tailwindcss": "^0.6.11",
    "tailwindcss": "^4",
    "tw-animate-css": "^1.3.0",
    "typescript": "^5"
  }
}

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