Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Error: ENOENT: no such file or directory #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ZhaoxiZhang opened this issue Oct 29, 2018 · 5 comments
Closed

Error: ENOENT: no such file or directory #130

ZhaoxiZhang opened this issue Oct 29, 2018 · 5 comments
Labels

Comments

@ZhaoxiZhang
Copy link

I follow Installation to install the tool on my Ubuntu 18.04. When I have installed successfully, I try to run the command leetcode version, but I could not get the expected result, here is my problem:

fs.js:122
    throw err;
    ^

Error: ENOENT: no such file or directory, open '/home/zyzhang/.lc/plugins.json'
    at Object.openSync (fs.js:443:3)
    at Object.writeFileSync (fs.js:1205:35)
    at Object.cache.set (/usr/local/lib/node_modules/leetcode-cli/lib/cache.js:22:6)
    at Plugin.save (/usr/local/lib/node_modules/leetcode-cli/lib/plugin.js:77:9)
    at Function.Plugin.save (/usr/local/lib/node_modules/leetcode-cli/lib/plugin.js:206:33)
    at initPlugins (/usr/local/lib/node_modules/leetcode-cli/lib/cli.js:57:12)
    at Object.cli.run (/usr/local/lib/node_modules/leetcode-cli/lib/cli.js:93:3)
    at Object.<anonymous> (/usr/local/lib/node_modules/leetcode-cli/bin/leetcode:3:23)
    at Module._compile (internal/modules/cjs/loader.js:707:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:718:10)

What's more, the following is my detail information:

zyzhang@zyzhang:~$ 
zyzhang@zyzhang:~$ node -v
v11.0.0
zyzhang@zyzhang:~$ npm -v
6.4.1
zyzhang@zyzhang:~$ 

Also, I try to install the tool on my Windows OS,but it get a problem as well.

xxx@DESKTOP-M4HL4KO MINGW64 /e/Programming Design/leetcode-cli (master)
$ leetcode login -l
fs.js:646
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open 'C:\Users\xxx\.lc\plugins.json'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.writeFileSync (fs.js:1299:33)
    at Object.cache.set (E:\Programming Design\leetcode-cli\lib\cache.js:22:6)
    at Plugin.save (E:\Programming Design\leetcode-cli\lib\plugin.js:77:9)
    at Function.Plugin.save (E:\Programming Design\leetcode-cli\lib\plugin.js:206:33)
    at initPlugins (E:\Programming Design\leetcode-cli\lib\cli.js:57:12)
    at Object.cli.run (E:\Programming Design\leetcode-cli\lib\cli.js:93:3)
    at Object.<anonymous> (E:\Programming Design\leetcode-cli\bin\leetcode:3:23)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)

the information on Windows

$ node -v
v8.12.0

$ npm -v
6.4.1
@nightwolf-chen
Copy link

You need to add the missing file to '/home/zyzhang/.lc/plugins.json', just create an empty file contains

{}

That works for me.

@lzl124631x
Copy link

Same issue. I think the cli should create it rather than throwing unfriendly error for new user.

@pengyu-hou
Copy link

Thanks @nightwolf-chen. It works for me by adding the file manually.. But it would be great if the script could have automated it

@DemiJiang33
Copy link

@nightwolf-chen Thank you !

@skygragon
Copy link
Owner

Fixed it in latest commit, will be included in next release.

Before that, please use the workaround above or try the latest dev code.

jminz pushed a commit to jminz/leetcode-cli that referenced this issue Dec 6, 2018
* move plugins' specific data into separate dirs.

* now leetcode/lintcode have different cache

Signed-off-by: Eric Wang <skygragon@gmail.com>

* Bump to 2.5.3

Signed-off-by: Eric Wang <skygragon@gmail.com>

* fixes skygragon#130: create home dir if necessary

Signed-off-by: Eric Wang <skygragon@gmail.com>

* [refactor] extract into file utils

Signed-off-by: Eric Wang <skygragon@gmail.com>

* Embed meta in comment instead of filename.

refs skygragon#55 skygragon#65

Signed-off-by: Eric Wang <skygragon@gmail.com>

* Update dev dependecies.

Signed-off-by: Eric Wang <skygragon@gmail.com>

* Update dependencies.

Signed-off-by: Eric Wang <skygragon@gmail.com>

* Bump to 2.5.4

Signed-off-by: Eric Wang <skygragon@gmail.com>

* fixes skygragon#112: use "--" as comment in sql file

Signed-off-by: Eric Wang <skygragon@gmail.com>

* [refactor] simplify template format.

Signed-off-by: Eric Wang <skygragon@gmail.com>

* refs skygragon#121: support customized filename.

Signed-off-by: Eric Wang <skygragon@gmail.com>

* [refactor] use file utils.

Signed-off-by: Eric Wang <skygragon@gmail.com>

* fixes typo in filename.

Signed-off-by: Eric Wang <skygragon@gmail.com>

* [pkg] add pkg config.

Signed-off-by: Eric Wang <skygragon@gmail.com>

* [plugin] enable/disable wont touch plugins js.

Signed-off-by: Eric Wang <skygragon@gmail.com>

* fixes plugin init order issue.

Signed-off-by: Eric Wang <skygragon@gmail.com>

* [plugin] always enable builtin plugin by default.

Signed-off-by: Eric Wang <skygragon@gmail.com>

* [pkg] add script for linux/macos

* refs skygragon#133

Signed-off-by: Eric Wang <skygragon@gmail.com>

* fixes format in `list`

Signed-off-by: Eric Wang <skygragon@gmail.com>

* fixes UT issues on windows.

Signed-off-by: Eric Wang <skygragon@gmail.com>

* [travis] enable more platforms

Signed-off-by: Eric Wang <skygragon@gmail.com>

* [pkg] refactor script for linux

Signed-off-by: Eric Wang <skygragon@gmail.com>

* [pkg] add script for windows

Signed-off-by: Eric Wang <skygragon@gmail.com>

* exit with error code if necessary

Signed-off-by: Eric Wang <skygragon@gmail.com>

* [pkg] bail out if error occurs

Signed-off-by: Eric Wang <skygragon@gmail.com>

* [pkg] build from travis

Signed-off-by: Eric Wang <skygragon@gmail.com>

* Bump to 2.6.0

Signed-off-by: Eric Wang <skygragon@gmail.com>

* [pages] update docs.

Signed-off-by: Eric Wang <skygragon@gmail.com>

* expose more code to plugins.

* leetcode.cn/lintcode could reuse this.

Signed-off-by: Eric Wang <skygragon@gmail.com>

* remove sprintf-js

Signed-off-by: Eric Wang <skygragon@gmail.com>

* fixes UT bug.

Signed-off-by: Eric Wang <skygragon@gmail.com>

* refs skygragon#134: remove whitespace on windows.

Signed-off-by: Eric Wang <skygragon@gmail.com>

* Bump to 2.6.1

Signed-off-by: Eric Wang <skygragon@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants