Skip to content
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

ds login or ds --version #241

Open
moogacs opened this issue Jun 10, 2019 · 12 comments
Open

ds login or ds --version #241

moogacs opened this issue Jun 10, 2019 · 12 comments

Comments

@moogacs
Copy link
Contributor

moogacs commented Jun 10, 2019

Bug

Expected behavior:

redirect to login with github

Actual behavior:

Error: /Users/$USRNAME/.entropicrc
at load (/usr/local/lib/node_modules/ds/lib/config.js:21:11)

Environment info (where relevant)

OSX 10.14.5

  • Version of Node (node -v):
    v12.4.0
  • Version of ds (ds --version):
    error
    at load (/usr/local/lib/node_modules/ds/lib/config.js:21:11)
@moogacs
Copy link
Contributor Author

moogacs commented Jun 10, 2019

It's still related to #104 for even node v12

@zacanger
Copy link
Contributor

zacanger commented Jun 10, 2019

https://github.com/entropic-dev/entropic/blob/master/cli/lib/config.js#L21 if you're up to date with master, that error would seem to imply that you have a syntax error in your ~/.entropicrc. It should look something like

[registries."https://registry.entropic.dev"]
token = "ent_v1_TOKEN_HERE"

Could you post the contents here (with token redacted)?

EDIT: I misread the function, it looks like line 28 would mean a syntax error, not 21. To debug, maybe you could log out e.code there?

@moogacs
Copy link
Contributor Author

moogacs commented Jun 10, 2019

That's is the point actually , I am up to date with master but the point is ~/.entropicrc not theres at all not created

@moogacs
Copy link
Contributor Author

moogacs commented Jun 10, 2019

it trying to load non existing file and dir (the error make sense), the point is where is actual .entropicrc creation

@zacanger
Copy link
Contributor

The file gets created by this function which is called here. Could you add a console.log(e) before the throw here and see if there are any more details?

@moogacs
Copy link
Contributor Author

moogacs commented Jun 10, 2019

that what i expected and then after logging

[Error: EISDIR: illegal operation on a directory, read] {
errno: -21,
code: 'EISDIR',
syscall: 'read'
}

@zacanger
Copy link
Contributor

zacanger commented Jun 10, 2019

Ah okay, so that's saying you have a directory at ~/.entropicrc. Try getting rid of that, and then ds login should work.

@moogacs
Copy link
Contributor Author

moogacs commented Jun 10, 2019

cool it's working now, but suppose that we provide an error for that case !

@moogacs
Copy link
Contributor Author

moogacs commented Jun 10, 2019

what about changing this with if (e.code === 'ENOENT' || e.code === 'EISDIR') {

@zacanger
Copy link
Contributor

zacanger commented Jun 10, 2019

That would still wind up throwing an error in the save function. It might make sense to just add another case, something like:

if (e.code === 'ENOENT') {
  return {};
}

if (e.code === 'EISDIR') {
  throw new errors.CouldNotReadConfigFile(filename, 'File is a directory!');
}

throw new errors.CouldNotReadConfigFile(filename, e);

so that the user can correct the problem.

@moogacs
Copy link
Contributor Author

moogacs commented Jun 10, 2019

@zacanger if you wouldn't mind i will have a PR for it

moogacs added a commit to moogacs/entropic that referenced this issue Jun 10, 2019
…g error

fixes in case ther's was a dir or file plus adding logginf error message to Errors
@viktor-ku
Copy link

#186

This will make lifes easier since it's handling everything in sync. Also modified error messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants