quaertym / ember-cli-dependency-checker

Ember CLI addon for checking missing node and bower dependencies before running ember commands
MIT License
40 stars 38 forks source link

semver doesn't recognise a version of "*" #18

Closed simonexmachina closed 9 years ago

simonexmachina commented 9 years ago

If a dependency has a version of "*" then the dependency checker throws an exception, and doesn't indicate where the dependency is coming from.

Invalid Version: *
TypeError: Invalid Version: *
    at new SemVer (terminal/node_modules/ember-cli-dependency-checker/node_modules/semver/semver.js:273:11)
    at Range.test (terminal/node_modules/ember-cli-dependency-checker/node_modules/semver/semver.js:998:15)
    at Function.satisfies (terminal/node_modules/ember-cli-dependency-checker/node_modules/semver/semver.js:1047:16)
    at Package.updateRequired (terminal/node_modules/ember-cli-dependency-checker/lib/package.js:35:18)
    at new Package (terminal/node_modules/ember-cli-dependency-checker/lib/package.js:7:27)
    at EmberCLIDependencyChecker.<anonymous> (terminal/node_modules/ember-cli-dependency-checker/lib/dependency-checker.js:85:12)
    at Array.map (native)
    at EmberCLIDependencyChecker.readBowerDependencies (terminal/node_modules/ember-cli-dependency-checker/lib/dependency-checker.js:82:36)
    at EmberCLIDependencyChecker.checkDependencies (terminal/node_modules/ember-cli-dependency-checker/lib/dependency-checker.js:28:24)
    at new EmberCLIDependencyChecker (terminal/node_modules/ember-cli-dependency-checker/lib/dependency-checker.js:19:8)
cmosguy commented 9 years ago

What do you do when you get this?

simonexmachina commented 9 years ago

To make this happen? I'll not sure what package causes it, but presumably there a dependency somewhere that refers to a version of "*", which means " any version ".

On Wed, 14 Jan 2015 13:39 Adam Klein notifications@github.com wrote:

What do you do when you get this?

— Reply to this email directly or view it on GitHub https://github.com/quaertym/ember-cli-dependency-checker/issues/18#issuecomment-69860568 .

cmosguy commented 9 years ago

@aexmachina this stinks, I am removing this. why did someone put this in the ember-cli 0.1.7 and not test this?

simonexmachina commented 9 years ago

It's a useful module, but yes could have done with more testing.

On Wed, 14 Jan 2015 13:42 Adam Klein notifications@github.com wrote:

@aexmachina https://github.com/aexmachina this stinks, I am removing this. why did someone put this in the ember-cli 0.1.7 and not test this?

— Reply to this email directly or view it on GitHub https://github.com/quaertym/ember-cli-dependency-checker/issues/18#issuecomment-69860771 .

cmosguy commented 9 years ago

@aexmachina I am interested in understanding more about this module, but there is absolutely no documention anywhere on this github. Can you point me to anything?

simonexmachina commented 9 years ago

Nope, I know nothing about it either.

On Wed, 14 Jan 2015 13:47 Adam Klein notifications@github.com wrote:

@aexmachina https://github.com/aexmachina I am interested in understanding more about this module, but there is absolutely no documention anywhere on this github. Can you point me to anything?

— Reply to this email directly or view it on GitHub https://github.com/quaertym/ember-cli-dependency-checker/issues/18#issuecomment-69861139 .

quaertym commented 9 years ago

@aexmachina I cannot reproduce the issue, it gives the expected output. Do you have a specific example that demonstrates this issue?

simonexmachina commented 9 years ago

In out right now, but I can try when I get back

On Wed, 14 Jan 2015 13:54 Emre Unal notifications@github.com wrote:

@aexmachina https://github.com/aexmachina I cannot reproduce the issue, it gives the expected output. Do you have a specific example that demonstrates this issue?

— Reply to this email directly or view it on GitHub https://github.com/quaertym/ember-cli-dependency-checker/issues/18#issuecomment-69861630 .

quaertym commented 9 years ago

@cmosguy This repo is well tested for many main scenarios we can imagine. See https://github.com/quaertym/ember-cli-dependency-checker/tree/master/tests. Please submit a failing test if you have a specific scenario that is not satisfied.

quaertym commented 9 years ago

@aexmachina any updates?

simonexmachina commented 9 years ago

Just getting to it now...

cmosguy commented 9 years ago

OK, so here is one problem:

version: 0.1.2
Object #<Project> has no method 'bowerDependencies'
TypeError: Object #<Project> has no method 'bowerDependencies'
    at EmberCLIDependencyChecker.readBowerDependencies (c:\Users\kleinada\workspace\squarekings\ember-app\node_modules\ember-cli-dependency-checker\lib\dependency-checker.js:80:35)
    at EmberCLIDependencyChecker.checkDependencies (c:\Users\kleinada\workspace\squarekings\ember-app\node_modules\ember-cli-dependency-checker\lib\dependency-checker.js:28:24)
    at new EmberCLIDependencyChecker (c:\Users\kleinada\workspace\squarekings\ember-app\node_modules\ember-cli-dependency-checker\lib\dependency-checker.js:19:8)
    at c:\Users\kleinada\workspace\squarekings\ember-app\node_modules\ember-cli\lib\models\project.js:206:25
    at visit (c:\Users\kleinada\workspace\squarekings\ember-app\node_modules\ember-cli\lib\utilities\DAG.js:23:3)
    at DAG.topsort (c:\Users\kleinada\workspace\squarekings\ember-app\node_modules\ember-cli\lib\utilities\DAG.js:82:7)
    at Project.initializeAddons (c:\Users\kleinada\workspace\squarekings\ember-app\node_modules\ember-cli\lib\models\project.js:202:9)
    at Project.eachAddonCommand (c:\Users\kleinada\workspace\squarekings\ember-app\node_modules\ember-cli\lib\models\project.js:229:10)
    at module.exports (c:\Users\kleinada\workspace\squarekings\ember-app\node_modules\ember-cli\lib\cli\lookup-command.js:52:13)
    at CLI.<anonymous> (c:\Users\kleinada\workspace\squarekings\ember-app\node_modules\ember-cli\lib\cli\cli.js:31:26)

Here is bower.json: https://gist.github.com/cmosguy/bd2321a8c62599124235 package.json: https://gist.github.com/cmosguy/68ed838076c43d06ebc2

What should I do here?

Thanks, Adam

quaertym commented 9 years ago

@cmosguy What's your ember-cli and ember-cli-dependency-checker version? edit: ok ember-cli is 0.1.2

cmosguy commented 9 years ago

@quaertym ember-cli 0.1.2 and whatever version you get for the checker when you do npm install.

quaertym commented 9 years ago

@cmosguy OK, bowerDependencies() added to ember-cli with version 0.1.3. The way to fix this is to upgrade ember-cli or downgrade ember-cli-dependency-checker to v0.0.5.

cmosguy commented 9 years ago

@quaertym just find this: https://github.com/ember-cli/ember-cli/issues/2567 which relates to what you were talking about.

quaertym commented 9 years ago

@aexmachina OK, closing this issue now, if you find a specific case where dependency checker fails please submit another issue.

simonexmachina commented 9 years ago

Okay, happy for you to close it, but this is definitely still an issue. I just haven't had a chance to provide an example.​

quaertym commented 9 years ago

@aexmachina I do not get how it is an issue if you cannot provide an example.

simonexmachina commented 9 years ago

I've submitted a PR which provides a better error message. For some reason the bower package for swfobject has a .bower.json file that doesn't provide a version. When this happens ember-cli-dependency-checker assumes a version of *, which makes server.satisfies() throw an error.

Not sure what the correct behaviour should be. Any suggestions?

quaertym commented 9 years ago

@aexmachina Hmm, swfobject case is interesting. The latest stable release of swfobject is 2.2 which is not a valid semantic version. A valid semver version should be like 2.2.0. I do not think it is a scalable solution to cover all non-standard bower packages. I think submiting a pr about proper bower.json to the upstream repo(swfobject in this case) is a solution that benefits not just ember-cli users but a larger community.

simonexmachina commented 9 years ago

Cool, I'll create a PR for swfobject. Looks like they're already on it for their v2.3.0 release but it's still beta right now.

walter commented 9 years ago

I tracked down my instance of the same issue to Sanitize.js from within ember-sanitize add-on (in my case I was using ember-cli 0.1.12). There is already an issue requesting semver to be added to Sanitize.js, though I'm not holding my breath.

Looking for a workaround.

walter commented 9 years ago

Ok, my issue is sorted, too.

I added the diplomatic comment to the existing Sanitize.js issue and all that was needed was adding a semver compliant tag to the repository and then everything just worked.

So lesson is to figure out what bower packaged lib isn't properly semver tagged and ask the maintainer to add it.

quaertym commented 9 years ago

@walter Great :+1: otherwise it would be very hard to workaround all those non-semver packages.

karri-sek commented 9 years ago

Hi Getting the same error: after running this command: Command: git add -f bower_components/ember/ember.js bower_components/ember/ember.prod.js bower_components/ember-cli-shims/app-shims.js bower_components/ember-cli-test-loader/test-loader.js bower_components/ember-data/ember-data.js bower_components/ember-data/ember-data.prod.js bower_components/ember-load-initializers/ember-load-initializers.js bower_components/ember-resolver/dist/modules/ember-resolver.js bower_components/jquery/dist/jquery.js bower_components/loader/loader.js bower_components/handlebars/handlebars.js bower_components/handlebars/handlebars.runtime.js

I ran the above command inorder to make my ember cli build process faster. for more details please visit this link. http://stackoverflow.com/questions/24782479/how-to-debug-slow-ember-cli-broccoli-builds

Then results me the following error:

D:\software\emberProjects\todomvc-embercli>ember serve Invalid Version: TypeError: Invalid Version: at new SemVer (D:\software\emberProjects\todomvc-emb 95:11) at Range.test (D:\software\emberProjects\todomvc-emb 049:15) at Function.satisfies (D:\software\emberProjects\tod ver.js:1098:16) at Package.updateRequired (D:\software\emberProjects 8) at new Package (D:\software\emberProjects\todomvc-em at EmberCLIDependencyChecker. (D:\softwar dependency-checker.js:85:12) at Array.map (native) at EmberCLIDependencyChecker.readBowerDependencies ( ecker\lib\dependency-checker.js:82:36)

dangreenisrael commented 9 years ago

I just got the same error after running some updates. It's not the first time that it's happened either.

Here is my package.json

{
  "name": "whats-due-cordova",
  "version": "0.0.0",
  "description": "Small description for whats-due-cordova goes here",
  "private": true,
  "directories": {
    "doc": "doc",
    "test": "tests"
  },
  "scripts": {
    "build": "ember build",
    "start": "ember server",
    "test": "ember test"
  },
  "repository": "",
  "engines": {
    "node": ">= 0.10.0"
  },
  "author": "",
  "license": "MIT",
  "devDependencies": {
    "broccoli-asset-rev": "^2.1.2",
    "ember-bootstrap-switch": "0.2.0",
    "ember-cli": "1.13.8",
    "ember-cli-app-version": "0.5.0",
    "ember-cli-babel": "^5.1.3",
    "ember-cli-content-security-policy": "0.4.0",
    "ember-cli-delay-app-boot": "1.0.2",
    "ember-cli-dependency-checker": "1.0.1",
    "ember-cli-fastclick": "1.0.4",
    "ember-cli-font-awesome": "0.1.1",
    "ember-cli-htmlbars": "0.7.9",
    "ember-cli-htmlbars-inline-precompile": "^0.2.0",
    "ember-cli-ic-ajax": "0.2.1",
    "ember-cli-inject-live-reload": "^1.3.1",
    "ember-cli-less": "1.3.3",
    "ember-cli-qunit": "^1.0.0",
    "ember-cli-release": "0.2.3",
    "ember-cli-remote-inspector": "^0.1.0",
    "ember-cli-sri": "^1.0.3",
    "ember-cli-uglify": "^1.2.0",
    "ember-data": "2.0.0",
    "ember-disable-proxy-controllers": "^1.0.0",
    "ember-export-application-global": "^1.0.3",
    "ember-group-by": "0.0.2",
    "ember-in-viewport": "2.0.0",
    "ember-infinity": "0.1.2",
    "ember-localforage-adapter": "2.0.0"
  }
}

Here is my bower.json

{
  "name": "whats-due-cordova",
  "dependencies": {
    "ember": "^2.0.0",
    "ember-cli-test-loader": "ember-cli-test-loader#0.1.3",
    "ember-data": "^2.0.0",
    "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.5",
    "ember-qunit": "0.4.9",
    "ember-qunit-notifications": "0.0.7",
    "ember-resolver": "~0.1.18",
    "jquery": "^1.11.3",
    "loader.js": "ember-cli/loader.js#3.2.1",
    "qunit": "~1.18.0",
    "moment": "~2.10.2",
    "moment-timezone": "~0.4.0",
    "fastclick": "~1.0.6",
    "localforage": "~1.2.1",
    "bootstrap-switch": "^3.3.2",
    "font-awesome": "~4.4.0"
  },
  "resolutions": {
    "ember": "^2.0.0"
  }
}

Note, I have run bower prune bower cache clean npm cache clean all with no luck I'm going to look for a workaround

dangreenisrael commented 9 years ago

here is my error message

Invalid Version: *
TypeError: Invalid Version: *
    at new SemVer (/Users/Dan/Git Repos/WhatsDue App/source/node_modules/ember-cli-dependency-checker/node_modules/semver/semver.js:295:11)
    at Range.test (/Users/Dan/Git Repos/WhatsDue App/source/node_modules/ember-cli-dependency-checker/node_modules/semver/semver.js:1049:15)
    at Function.satisfies (/Users/Dan/Git Repos/WhatsDue App/source/node_modules/ember-cli-dependency-checker/node_modules/semver/semver.js:1098:16)
    at Function.VersionChecker.satisfies (/Users/Dan/Git Repos/WhatsDue App/source/node_modules/ember-cli-dependency-checker/lib/version-checker.js:31:17)
    at Package.updateRequired (/Users/Dan/Git Repos/WhatsDue App/source/node_modules/ember-cli-dependency-checker/lib/package.js:19:26)
    at Package.init (/Users/Dan/Git Repos/WhatsDue App/source/node_modules/ember-cli-dependency-checker/lib/package.js:14:27)
    at new Package (/Users/Dan/Git Repos/WhatsDue App/source/node_modules/ember-cli-dependency-checker/lib/package.js:4:13)
    at EmberCLIDependencyChecker.<anonymous> (/Users/Dan/Git Repos/WhatsDue App/source/node_modules/ember-cli-dependency-checker/lib/dependency-checker.js:109:12)
    at Array.map (native)
    at EmberCLIDependencyChecker.readBowerDependencies (/Users/Dan/Git Repos/WhatsDue App/source/node_modules/ember-cli-dependency-checker/lib/dependency-checker.js:106:36)
dangreenisrael commented 9 years ago

I also moved between git branches, I suspect that this may have something to do with it.

Although, I have all of my vendors in .gitignore

dangreenisrael commented 9 years ago

I wound up solving it by following the steps for an update (I did not do an update)

https://github.com/ember-cli/ember-cli/releases

Hope this helps

quaertym commented 9 years ago

@dangreenisrael Glad it is solved for you.

aanand-drg commented 8 years ago

@dangreenisrael I had the same issue, your link solved this for me.