skygragon / leetcode-cli

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

Unknown language "javascript" #80

Closed fuermosi777 closed 6 years ago

fuermosi777 commented 6 years ago

Problem Summary

run leetcode show 523 -x -g, got an error

[ERROR] Unknown language "javascript" [0]

How to reproduce

Skip

Environment

[Environment] Node v7.7.2 OS darwin 17.2.0

[Configuration] AUTO_LOGIN true COLOR_THEME default ICON_THEME LANG javascript MAX_WORKERS 10 USE_COLOR true

[Themes] Colors blue,dark,default,orange,pink Icons ascii,default,win7

zhangxiliang commented 6 years ago

I have this problem, too

gopricy commented 6 years ago

Same here, no matter which language I choose. I guess there might be some changes to leetcode's API.

wzjmit commented 6 years ago

It seems that leetcode had removed templates and testcase from pageData https://github.com/skygragon/leetcode-cli/blob/8b7d55f9b53dac0bf1f26f04ba6b6fdb073d6aae/lib/plugins/leetcode.js#L148-L150

skygragon commented 6 years ago

Yep, leetcode.com is using a new API o fetch question details, that's why we failed to get detailed info from "pageData" in the old html.

I have made a quick fix for it but have no time for a full regression testings right now (e.g. submission, star command, and 3rd party plugins). While you guys can still try it out now to see if there are other errors remained:

$ npm install -g skygragon/leetcode-cli

please ping me for any errors you meet, will revisit this tomorrow I hope.

gopricy commented 6 years ago

It works for me. Thanks for your hotfix!

gopricy commented 6 years ago

It is not totally fixed. I can show most problems properly now, but some not. For example, lc 537 still shows Unknown language error.

leetcode show 537 -g -x

skygragon commented 6 years ago

@GameBurning try clean cache?

leetcode cache -d 537.complex-number-multiplication.algorithms
gopricy commented 6 years ago

@skygragon Thanks! The cached json is the cause.

yefeiw commented 6 years ago

My two cents since I had the exact same problem...

Make sure we call "leetcode cache -d" before trying again after upgrading the leetcode cli. That will clean all caches and will make sure we don't see similar problems again.

pengyu-hou commented 6 years ago

Reinstallation and cleaning the cache solved the problem for me.

npm install -g skygragon/leetcode-cli
leetcode cache -d true
fuermosi777 commented 6 years ago

Worked after upgrading to 2.1.0 and clear cache.

Pyboon commented 6 years ago

I meet this problem again : [ERROR] Unknown language "cpp" [0] yesterday I have upgraded to new version 2.1 and work well but the issue appears today

skygragon commented 6 years ago

@Pyboon give another try after running leetcode cache -d?

Pyboon commented 6 years ago

still have trouble

skygragon commented 6 years ago

@Pyboon 175/176/181 are all sql questions, so "cpp" doesn't work for them. please try:

leetcode show 175 -gx -l mysql
Pyboon commented 6 years ago

I found that some problems occured the issue but some did not, for example problem #181,#176.#175 had but #198 not, I just try some problems and do not konw the detail of other problems

skygragon commented 6 years ago

@Pyboon in the case you could omit "-gx" in your show command then you could see the question details first before generating source code via "-g".