traderjoe-xyz / joe-sdk

🛠 An SDK for building applications on top of Trader Joe.
MIT License
34 stars 29 forks source link

How can I use the npm module <@traderjoe-xyz/sdk> #29

Open crazydevlegend opened 2 years ago

crazydevlegend commented 2 years ago

I just installed nodemodule **@traderjoe-xyz/sdk_ using npm i @traderjoe-xyz/sdk** to use it in my node.js project. But when I tried to import it in my code, I showed an error:

node:internal/modules/cjs/loader:361
      throw err;
      ^

Error: Cannot find module '/home/<USER-NAME>/Desktop/projects/<PROJECT-NAME>/node_modules/@traderjoe-xyz/sdk/dist/index.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (node:internal/modules/cjs/loader:353:19)
    at Function.Module._findPath (node:internal/modules/cjs/loader:566:18)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
    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> (/home/<USER-NAME>/Desktop/projects/<PROJECT-NAME>/<SUBDIRECTORIES...>/traderjoe.js:1:70)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32) {
  code: 'MODULE_NOT_FOUND',
  path: '/home/<USER-NAME>/Desktop/projects/<PROJECT-NAME>/node_modules/@traderjoe-xyz/sdk/package.json',
  requestPath: '@traderjoe-xyz/sdk'
}

I checked the module directory inside _nodemodules folder, but it didn't have dist/index.js file.

Can anyone tell me how can I overcome this issue?

Any advice/help is appreciated!

Long story short, I WANNA USE TRADERJOE-XYZ/SDK IN MY NODE.JS PROJECT

crazydevlegend commented 2 years ago

I cloned this repository and created my own build version of the SDK library. And finally it works! Maybe this library is not stable yet, and still under development. (I can see some recent updates ...).