Sainglend / tda-api-client

A client library to use the API exposed by TD Ameritrade at https://developer.tdameritrade.com
GNU General Public License v3.0
75 stars 23 forks source link

"node ./cli_index.js" errors out with "Error: Cannot find module 'yargs'" #12

Open ApopheniaPays opened 2 years ago

ApopheniaPays commented 2 years ago

Not a node developer so maybe I'm missing something obvious, I'm just looking for a utility that makes it as easy as possible to consume the TDA API. I've already written a full client that does it, so I know how the API works, but parsing JSON myself is a pain so I'm trying other options.

$ node ./cli_index.js 
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'yargs'
Require stack:
- [filepath redacted]/tda-api-client-master/cli_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> (/[filepath redacted]/tda-api-client-master/cli_index.js:3:27)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/[filepath redacted]/tda-api-client-master/cli_index.js'
  ]
}

I took a guess and did npm i yargs, which did install something, but the script still isn't working.

Sainglend commented 2 years ago

This is on an older version, but I will look into this tonight. Apparently, I forgot to ship cli_index in v2 as well. Brilliant.

Sainglend commented 2 years ago

Alright, so from your output it looks like you cloned this locally. You will definitely need to install all the dependencies in order for it to work. So, cd into the tda-api-client directory. Run npm install to install all of the dependencies, then try it again!

Let me know.

Sainglend commented 2 years ago

I have fixed CLI issues in v2.1.1. If you are not able to upgrade to that (which has breaking changes from pre 2.0), let me know how the npm install thing works out for you and what version you ARE using.