jup-ag / jupiter-core-example

92 stars 56 forks source link

TypeError: fields must be array of Layout instances #3

Closed Necmttn closed 2 years ago

Necmttn commented 2 years ago

Right after the start of the application, it's crashing.

➜  jupiter-core-example git:(main) ✗ yarn start
yarn run v1.22.5
$ npm run watch & nodemon --watch ./dist --exec 'node ./dist/main.js' --delay 1000ms
[nodemon] 2.0.15
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): dist/**/*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node ./dist/main.js`
npm WARN lifecycle The node binary used for scripts is /var/folders/b_/695p375x3cd0tfxp0nzgyb9w0000gp/T/yarn--1641625841043-0.08431479813294107/node but npm is using /Users/necmttn/.nvm/versions/node/v14.17.6/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> jupiter-core-example@1.0.0 watch /Users/necmttn/Projects/crypto/jupiter-core-example
> parcel watch

/Users/necmttn/Projects/crypto/jupiter-core-example/node_modules/@jup-ag/core/node_modules/@saberhq/stableswap-sdk/node_modules/@saberhq/token-utils/node_modules/@solana/buffer-layout/lib/Layout.js:999
            throw new TypeError('fields must be array of Layout instances');
            ^

TypeError: fields must be array of Layout instances
    at new Structure (/Users/necmttn/Projects/crypto/jupiter-core-example/node_modules/@jup-ag/core/node_modules/@saberhq/stableswap-sdk/node_modules/@saberhq/token-utils/node_modules/@solana/buffer-layout/lib/Layout.js:999:19)
    at Object.exports.struct (/Users/necmttn/Projects/crypto/jupiter-core-example/node_modules/@jup-ag/core/node_modules/@saberhq/stableswap-sdk/node_modules/@saberhq/token-utils/node_modules/@solana/buffer-layout/lib/Layout.js:2373:57)
    at structLayout (/Users/necmttn/Projects/crypto/jupiter-core-example/node_modules/@jup-ag/core/node_modules/@saberhq/stableswap-sdk/node_modules/@saberhq/token-utils/dist/cjs/layout.js:18:73)
    at Object.<anonymous> (/Users/necmttn/Projects/crypto/jupiter-core-example/node_modules/@jup-ag/core/node_modules/@saberhq/stableswap-sdk/dist/cjs/state/layout.js:23:59)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
[nodemon] app crashed - waiting for file changes before starting...
Necmttn commented 2 years ago

add this line in package.json.

  "resolutions": {
    "**/@saberhq/token-utils/**/@solana/buffer-layout": "^3.0.0"
  }
giftedchen commented 2 years ago

add this line in package.json.

"resolutions": {
  "**/@saberhq/token-utils/**/@solana/buffer-layout": "^3.0.0"
}

not working for me

Necmttn commented 2 years ago

Try

yarn add   @solana/buffer-layout@4.0.0

and this

  "resolutions": {
    "@solana/buffer-layout": "4.0.0"
  }
shardo commented 2 years ago

Worked, thanks.