skygragon / leetcode-cli

A cli tool to enjoy leetcode!
MIT License
3.65k stars 459 forks source link

Failed to show problem #119

Closed shenmishajing closed 6 years ago

shenmishajing commented 6 years ago

I just install the leetcode-cli, but when I show problem withlc show 32 -gx,I get an error. There are my error info:

$ lc show 32 -vv
[TRACE] initializing all plugins
[TRACE] found plugin: leetcode=default
[TRACE] skipped plugin: leetcode
[TRACE] found plugin: lintcode=2018.05.30
[TRACE] skipped plugin: lintcode
[TRACE] found plugin: cache=default
[TRACE] inited plugin: cache
[TRACE] found plugin: leetcode.cn=2018.05.30
[TRACE] inited plugin: leetcode.cn
[TRACE] found plugin: retry=default
[TRACE] inited plugin: retry
[TRACE] missing plugins: 0
[DEBUG] cache hit: problems.json
/usr/local/lib/node_modules/leetcode-cli/node_modules/yargs/yargs.js:1100
      else throw err
           ^

TypeError: Cannot read property 'apply' of undefined
    at Plugin.plugin.(anonymous function) [as getProblem] (/usr/local/lib/node_modules/leetcode-cli/lib/plugins/retry.js:56:18)
    at Plugin.plugin.getProblem (/usr/local/lib/node_modules/leetcode-cli/lib/plugins/cache.js:41:15)
    at /usr/local/lib/node_modules/leetcode-cli/lib/core.js:95:15
    at Plugin.plugin.getProblems (/usr/local/lib/node_modules/leetcode-cli/lib/plugins/cache.js:21:12)
    at Plugin.core.getProblem (/usr/local/lib/node_modules/leetcode-cli/lib/core.js:87:8)
    at Object.cmd.handler (/usr/local/lib/node_modules/leetcode-cli/lib/commands/show.js:174:10)
    at Object.runCommand (/usr/local/lib/node_modules/leetcode-cli/node_modules/yargs/lib/command.js:228:22)
    at Object.parseArgs [as _parseArgs] (/usr/local/lib/node_modules/leetcode-cli/node_modules/yargs/yargs.js:1013:30)
    at Object.get [as argv] (/usr/local/lib/node_modules/leetcode-cli/node_modules/yargs/yargs.js:957:21)
    at runCommand (/usr/local/lib/node_modules/leetcode-cli/lib/cli.js:67:5)

and my config:

$ lc cfg -a
{
  "autologin": {
    "enable": true,
    "retry": 2
  },
  "code": {
    "editor": "emacs",
    "lang": "cpp"
  },
  "color": {
    "enable": true,
    "theme": "default"
  },
  "icon": {
    "theme": ""
  },
  "network": {
    "concurrency": 10
  },
  "plugins": {}
}

Environment

I have no idea at all, can you help me?

shenmishajing commented 6 years ago

I solve this by

  1. uninstall LeetCode-cli
  2. rm /usr/local/lib/node_modules/leetcode-cli
  3. reinstall node
  4. install leetcode-cli again

so, close .