ProjectOpenSea / opensea-js

TypeScript SDK for the OpenSea marketplace
https://docs.opensea.io/reference
MIT License
2.28k stars 955 forks source link

Error: Cannot find module 'wyvern-schemas/dist/types' #626

Closed qiushui777 closed 1 year ago

qiushui777 commented 2 years ago

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"
  }
justspd commented 2 years ago

I have same issue.

javiergrau commented 2 years ago

I was having the same issue but managed to get around it by deleting the wyvern-schemas package and any reference to it in package-lock.json. I then npm installed wyvern-schemas and it worked.

qiushui777 commented 2 years ago

I was having the same issue but managed to get around it by deleting the wyvern-schemas package and any reference to it in package-lock.json. I then npm installed wyvern-schemas and it worked.

thx for the reply. May I ask how you delete the reference to it?

    "node_modules/opensea-js": {
      "version": "4.0.3",
      "resolved": "https://registry.npmjs.org/opensea-js/-/opensea-js-4.0.3.tgz",
      "integrity": "sha512-kLY8wwbbPOu/FGS/0AdpNiWZCSZo6Megh0ku3omJVU1KABGDT6I6ggFbhg7DNbyUubfD/0V0dtrwCDrf6YGGsw==",
      "dependencies": {
        "@opensea/seaport-js": "^1.0.0",
        "ajv": "^8.11.0",
        "bignumber.js": "9.0.2",
        "ethereumjs-abi": "git+https://github.com/ProjectWyvern/ethereumjs-abi.git",
        "ethereumjs-util": "^5.2.0",
        "ethers": "^5.6.6",
        "fbemitter": "2.1.1",
        "isomorphic-unfetch": "^2.1.1",
        "lodash": "^4.17.21",
        "query-string": "^6.11.1",
        "web3": "1.7.0",
        "wyvern-js": "git+https://github.com/ProjectOpenSea/wyvern-js.git#d283749f3d983a9c9e2e4da925441f75e170c9f0",
        "wyvern-schemas": "git+https://github.com/ProjectOpenSea/wyvern-schemas.git#3290fc095649f5552b560bfcb1f0fa49acf13894"
      }
    },

like I delete the

        "wyvern-schemas": "git+https://github.com/ProjectOpenSea/wyvern-schemas.git#3290fc095649f5552b560bfcb1f0fa49acf13894"

part? I delete all these and uninstall the wyvern-schemas then install again. But failed with the same error

alex-bormotov commented 2 years ago

Same error, how to fix? tried install wyvern-schemas, but the same. Tried all what write here - the same error. Mac M1. thanks

beauhodes commented 2 years ago

Same error, how to fix? tried install wyvern-schemas, but the same. Tried all what write here - the same error. Mac M1. thanks

I've had various issues with opensea-js over the past couple weeks, but weirdly enough it works fine if I use yarn to install it (just "yarn add opensea-js").

jamesrwaugh commented 2 years ago

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 😩

sarahkittyy commented 2 years ago

Why was this closed? This issue is still occuring

Fraeddy commented 2 years ago

agreed. This should still be open...

qiushui777 commented 2 years ago

@jamesrwaugh and @beauhodes 's solutions not working? I just gave up and wrote one in py on my own.

KModestas commented 2 years ago

It

Same error, how to fix? tried install wyvern-schemas, but the same. Tried all what write here - the same error. Mac M1. thanks

I've had various issues with opensea-js over the past couple weeks, but weirdly enough it works fine if I use yarn to install it (just "yarn add opensea-js").

Yep, it works for me if i install node_modules with yarn rather than npm. (I'm using WSL2)

alex-lighthouse commented 1 year ago

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?

xin-xinusu commented 1 year ago

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?

--- Can confirm this did resolve issue for me

qnft-mjb commented 1 year ago

Getting this error in my Google cloud console upon deploying a cloud function. I imagine the gcloud deploy node runtime uses npm which is why this might be happening? Function runs fine locally with functions-framework cause my project workspace is built with yarn and the dist file is there. Any idea of a solve/work around?

ds-hamza commented 1 year ago

Using yarn instead of npm fixes this for me...

yarn add opensea-js

kevgithub commented 1 year ago

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

KoolKat-Bytes commented 1 year ago

While using yarn to install opensea-js a WARNING message is raised:

warning "opensea-js > wyvern-schemas@0.14.1" has incorrect peer dependency "wyvern-js@git+https://github.com/ProjectOpenSea/wyvern-js.git#7429b1f2dd123f012cae1f3144a069e91ecd0682".

Maybe this is related to the problem. To be continued !

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.