componentjs / component

frontend package manager and build tool for modular web applications
https://github.com/componentjs/guide
MIT License
4.55k stars 306 forks source link

..."component.json" is not valid JSON #621

Closed aprilb closed 9 years ago

aprilb commented 9 years ago

Does anyone know why I would be getting an error related to lodash --in which the wrong version is being downloaded?

component-resolver:semver resolving semver lodash/lodash@~2.4.1 +0ms <-- should be pinned to this.

Error: cogent "https://raw.githubusercontent.com/lodash/lodash/3.0.0-npm-packages/component.json" is not valid JSON +299ms <-- wrong version

Partial build log with the error: https://gist.github.com/aprilb/de6ac9f9b72d99ab0da4

netpoetica commented 9 years ago

This is pretty strange - I am curious if you would have the same error with a different version of lodash? The URL for that component.json is dead, so it's "not valid JSON" because the response is text:

Not Found

Can you run again with DEBUG=* in front and give that output? I'm curious about the "<-- wrong version" in there, it doesn't look familiar

aprilb commented 9 years ago

@netpoetica here is the entire log using mf DEBUG=*

Lodash stuff starts at line: https://gist.github.com/aprilb/cfd63f68467f07dad968#file-gistfile1-txt-L3677

netpoetica commented 9 years ago

One last thing - what does your component.json look like? I think it's very strange that with ~2.4.1 specified we're seeing this 3.0.0-npm-packages in the slug where it's looking for the component.json

aprilb commented 9 years ago

I started another thread earlier: https://github.com/lodash/lodash/issues/861

which resulted in this change: https://github.com/ifandelse/machina.js/blob/master/component.json#L9

I believe this is the source, but the change should have remedied it.

aprilb commented 9 years ago

Also, that is a remote dependency.

netpoetica commented 9 years ago

It looks like it will install without trouble if you don't have a ~ tilde in front of the package, if you need a fast solution (I noticed you said it is breaking your builds). i.e. you can run component install lodash/lodash@2.4.1 without trouble

Even though ~2.4.1 is specified, it's resolving to use that tag 3.0.0-npm-packages which does not have a component.json. The same error comes from DEBUG=* component install lodash/lodash.

netpoetica commented 9 years ago

@timaschew Do you think it's a bug, or maybe I am missing something, that

{
  'lodash/lodash': '~2.4.1'
}

Should attempt to resolve from these tags to "3.0.0-npm-packages" when there is clearly a 2.4.1 tag on that list?

timaschew commented 9 years ago

Looks like a bug, hmm, I'll test it for another remote

aprilb commented 9 years ago

@timaschew thanks for looking into it.

netpoetica commented 9 years ago

@timaschew I was testing this a little yesterday with components/jquery and tried things like:

DEBUG=* component install components/jquery@~1.7

Where it would resolve that 1.7.2 was the right tag to use, but then give an error:

fatal : no remote found for dependency "components/jquery@1.7.2". Visit http://component.github.io/troubleshooting for help.

Edit: removed invalid comment and test case :)

Sharing because I think these might be useful test cases and had started some bit of adding tests for these and looking through the resolver code, but haven't quite found yet where we are looking at available tags and determining which one is appropriate

timaschew commented 9 years ago

thanks, found the error, it was a side effect of some change in the last resolver by me. It become a problem here: https://github.com/componentjs/resolver.js/commit/2dceb3bf5713b39c2f5813032635dc934e2832ff#commitcomment-9372384

I already fixed it, need to clean up and commit&push it.

BTW: components/jquery@~1.7 is another issue, version 1.7.2 has no comonent.json: https://github.com/components/jquery/tree/2c28f73cb57535e37283b7f27fa1e06307bd09af

sankargorthi commented 9 years ago

@timaschew Thanks! :trophy: