opensea-js: Error: Cannot find module 'wyvern-schemas/dist/types'

Hi I got this error while trying to use the sdk.

node:internal/modules/cjs/loader:933
  const err = new Error(message);
              ^

Error: Cannot find module 'wyvern-schemas/dist/types'
Require stack:
- /root/dev//node_modules/opensea-js/lib/utils/schema.js
- /root/dev//node_modules/opensea-js/lib/utils/index.js
- /root/dev//node_modules/opensea-js/lib/orders/utils.js
- /root/dev//node_modules/opensea-js/lib/api.js
- /root/dev//node_modules/opensea-js/lib/index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/root/dev/openseaarb/node_modules/opensea-js/lib/utils/schema.js:26:15)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/root/dev/openseaarb/node_modules/opensea-js/lib/utils/index.js:13:14)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/root/dev/openseaarb/node_modules/opensea-js/lib/utils/schema.js',
    '/root/dev/openseaarb/node_modules/opensea-js/lib/utils/index.js',
    '/root/dev/openseaarb/node_modules/opensea-js/lib/orders/utils.js',
    '/root/dev/openseaarb/node_modules/opensea-js/lib/api.js',
    '/root/dev/openseaarb/node_modules/opensea-js/lib/index.js'
  ]
}

here are my dependecies

  "dependencies": {
    "opensea-js": "^4.0.3",
    "web3": "^1.7.4"
  }

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 6
  • Comments: 17

Most upvoted comments

On my side, the issue was caused by the missing dist folder when pulling wyvern-schemas from Github. If you look at node_modules/wyvern-schemas, it will be missing the dist folder.

I also didn’t want to npm/yarn install wyvern-schema since it would install 0.6.5 from npm which dates back five years ago instead of the fork of it referenced here in the package.json

The solution on my side ended up having to install yarn (not yarn install, just install it through npm i -g yarn). Once yarn was installed on my machine (or ci server), I simply deleted node_modules/wyvern-schemas, ran npm install again, and the dist folder that I mentioned above is now properly generated.

Could it be caused by the fact that wyvern-schemas fork has a prepublish script that calls a bash script that calls yarn? Would be nice to fix that script to accept either yarn or npm. Or run it though npx?

On my side, the issue was caused by the missing dist folder when pulling wyvern-schemas from Github. If you look at node_modules/wyvern-schemas, it will be missing the dist folder.

I also didn’t want to npm/yarn install wyvern-schema since it would install 0.6.5 from npm which dates back five years ago instead of the fork of it referenced here in the package.json

The solution on my side ended up having to install yarn (not yarn install, just install it through npm i -g yarn). Once yarn was installed on my machine (or ci server), I simply deleted node_modules/wyvern-schemas, ran npm install again, and the dist folder that I mentioned above is now properly generated.

Could it be caused by the fact that wyvern-schemas fork has a prepublish script that calls a bash script that calls yarn? Would be nice to fix that script to accept either yarn or npm. Or run it though npx?

It works! Thanks

A quick fix I did for NPM:

Go to node_modules/wyvern-schemas

Download the Git reference in the package-lock for opensea-js, for 4.0.4 it’s https://github.com/ProjectOpenSea/wyvern-schemas#3290fc095649f5552b560bfcb1f0fa49acf13894=

Unzip that folder there.

Of course, this has to be done after every npm install, just don’t delete node_modules 😩