Skip to content

bug: Cannot find module 'node-fetch' from '../node_modules/@cowprotocol/contracts/lib/commonjs/api.js' #227

@mmv08

Description

@mmv08

when you import something from the root of the SDK, e.g.,

import { EnrichedOrder, OrderBookApi } from '@cowprotocol/cow-sdk'

it fails with:

 Cannot find module 'node-fetch' from '../node_modules/@cowprotocol/contracts/lib/commonjs/api.js'

    Require stack:
      /home/mmv/Projects/Safe/safenet/processor-service/node_modules/@cowprotocol/contracts/lib/commonjs/api.js
      /home/mmv/Projects/Safe/safenet/processor-service/node_modules/@cowprotocol/contracts/lib/commonjs/index.js
      /home/mmv/Projects/Safe/safenet/processor-service/node_modules/@cowprotocol/cow-sdk/dist/index.js
      /home/mmv/Projects/Safe/safenet/processor-service/src/modules/transaction/transaction.multisigtx.parser.ts
      /home/mmv/Projects/Safe/safenet/processor-service/src/modules/transaction/transaction.scheduler.ts
      /home/mmv/Projects/Safe/safenet/processor-service/src/modules/transaction/transaction.module.ts
      /home/mmv/Projects/Safe/safenet/processor-service/src/app.module.ts
      safenet.e2e-spec.ts

I took a brief look and it seems the reason for this is that the package.json for @cowprotocol/[email protected] does not install node-fetch package used in the API file in the same package

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions