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

Still having : throw new Error('Cyclic dependency: '+JSON.stringify(node)) #25

Closed
darkylmnx opened this issue Jun 16, 2018 · 9 comments
Closed

Comments

@darkylmnx
Copy link

I just upgraded to the new Vue CLI which internally uses new Webpack 4 which uses toposort, as soon as I upgraded, this happend.

image

@marcelklehr
Copy link
Owner

Hey :)

Are you reporting this to this repo because of the "circular structure" JSON.stringify error? If not, then this looks like a normal error due to wrong use of toposort. Toposort throws an error if you try to sort circular data.

@darkylmnx
Copy link
Author

@marcelklehr yes i'm talking about the ""circular structure" JSON.stringify error". I'm not the one using toposort here, it seems to be a dep of webpack 4 and when the dep is >= 1.0.7 I have this error, when I force toposort to 1.0.6 or under it works

@darkylmnx
Copy link
Author

toposort@^1.0.0:
  version "1.0.6"
  resolved "https://registry.yarnpkg.com/toposort/-/toposort-1.0.6.tgz#c31748e55d210effc00fdcdc7d6e68d7d7bb9cec"

this works without an error, but any time I upgrade something I get this lock with the error mentioned in the console

toposort@^1.0.0:
  version "1.0.7"
  resolved "https://registry.yarnpkg.com/toposort/-/toposort-1.0.7.tgz#c31748e55d210effc00fdcdc7d6e68d7d7bb9cec"

@marcelklehr
Copy link
Owner

when I force toposort to 1.0.6 or under it works

oh. Interesting!

@marcelklehr
Copy link
Owner

However, the exact error you describe cannot happen with v1.0.7 anymore, because line 21 has been changed v1.0.4...v1.0.7

This diff also shows the difference between version 1.0.4 and v1.0.7 which is one test and said change around line 21. I highly doubt that there's an input that throws an error in v1.0.7 but doesn't in v1.0.4, but if you like you can create a gist or a repo that I can use to reproduce and debug.

@darkylmnx
Copy link
Author

darkylmnx commented Jun 16, 2018 via email

@alkurbatov
Copy link

alkurbatov commented Aug 6, 2018

Good morning, everybody.
I've got the same issue with toposort recently. While the real problem was in my Vue code (circular dependency in one of the components) toposort failed with "circular structure" in JSON.stringify.
It is turned out that when toposort investigates the circular dependency error it tries to throw out a Error and notify about it, however, it also tries to use JSON.stringify on the incoming json structure.
In my case the json structure was circular too so toposort failed to throw Error and hid the original reason.

This happened on 1.0.4 and 1.0.6.

Hope this helps.

@marcelklehr
Copy link
Owner

marcelklehr commented Aug 6, 2018 via email

@alkurbatov
Copy link

Hey @marcelklehr ,
thank you for the suggestion, the error processing code is much better now. I will update the dependency :)

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