leetcode-cli-plugins icon indicating copy to clipboard operation
leetcode-cli-plugins copied to clipboard

[github] Error: Cannot find module 'github'

Open dodouwang opened this issue 6 years ago • 9 comments

:~/leetcode$ leetcode push 106.construct-binary-tree-from-inorder-and-postorder-traversal.153319531.notac.cpp -vv
[TRACE] initializing all plugins
[TRACE] found plugin: cache=default
[TRACE] inited plugin: cache
[TRACE] found plugin: company=2017.12.18
[TRACE] inited plugin: company
[TRACE] found plugin: cpp.run=2017.07.29
[TRACE] inited plugin: cpp.run
[TRACE] found plugin: github=2018.03.24
[TRACE] inited plugin: github
[TRACE] found plugin: leetcode=default
[TRACE] inited plugin: leetcode
[TRACE] found plugin: retry=default
[TRACE] inited plugin: retry
[TRACE] found plugin: solution.discuss=2018.04.14
[TRACE] inited plugin: solution.discuss
[TRACE] missing plugins: 0
[DEBUG] cache hit: problems.json
[DEBUG] cache hit: 106.construct-binary-tree-from-inorder-and-postorder-traversal.algorithms.json
/usr/local/lib/node_modules/leetcode-cli/node_modules/yargs/yargs.js:1100
else throw err
^

Error: Cannot find module 'github'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Plugin.plugin.submitProblem (/usr/local/lib/node_modules/leetcode-cli/lib/plugins/github.js:29:19)
at /usr/local/lib/node_modules/leetcode-cli/lib/commands/submit.js:58:10
at /usr/local/lib/node_modules/leetcode-cli/lib/plugins/solution.discuss.js:81:45
at Plugin.plugin.getProblem (/usr/local/lib/node_modules/leetcode-cli/lib/plugins/cache.js:38:12)
at Plugin.plugin.getProblem (/usr/local/lib/node_modules/leetcode-cli/lib/plugins/solution.discuss.js:80:15)
at /usr/local/lib/node_modules/leetcode-cli/lib/core.js:95:15

dodouwang avatar May 08 '18 12:05 dodouwang

try to reinstall github plugin?

leetcode plugin -i github

skygragon avatar May 09 '18 02:05 skygragon

I have tried -D and then -i, nothing changed.

On Wed, May 9, 2018, 10:22 AM skygragon [email protected] wrote:

try to reinstall github plugin?

leetcode plugin -i github

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/skygragon/leetcode-cli-plugins/issues/12#issuecomment-387600024, or mute the thread https://github.com/notifications/unsubscribe-auth/Aj0of1NcKBsjVUF0Svj7u90Izw5IuXJIks5twlLfgaJpZM4T2lfd .

dodouwang avatar May 09 '18 02:05 dodouwang

The log shows you are missing a 3rd party library that leetcode-cli needed, which is called "github" as well. Please check if it exists or not:

# ls /usr/local/lib/node_modules/leetcode-cli/node_modules/github/
LICENSE      README.md    lib          package.json

Weird that leetcode plugin -i github should always install this 3rd party library automatically...

skygragon avatar May 09 '18 05:05 skygragon

I met the exact same problem.

cosmozhang avatar Aug 09 '18 23:08 cosmozhang

Fixed, need to use sudo

cosmozhang avatar Aug 09 '18 23:08 cosmozhang

@cosmozhang which version of npm do u use? Newer versions should not require sudo any more.

skygragon avatar Aug 18 '18 01:08 skygragon

5.6

cosmozhang avatar Aug 18 '18 12:08 cosmozhang

same error. npm 6.9

liangjiezhu avatar Apr 23 '19 07:04 liangjiezhu

I solved this problem by using "sudo leetcode plugin -i github"

hellosp avatar May 09 '19 06:05 hellosp