hapijs / glue

Server composer for hapi.js
Other
245 stars 62 forks source link

Glue does not use hapi v12.x.x #56

Closed mattiloh closed 8 years ago

mattiloh commented 8 years ago

Glue seems not to take the latest hapi-version as intended. To reproduce the behavior I set up a test project with the following package.json and index.js:

{
  "name": "hapi-glue-test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "glue": "^3.0.0",
    "hapi": "^12.1.0"
  }
}
'use strict';

const Glue = require('glue');

const manifest = {
    connections: [{ port: 3000 }],
};

const options = {
    relativeTo: __dirname,
};

Glue.compose(manifest, options, (err, server) => {
    if (err) {
        throw err;
    }

    server.start(function () {
        console.log('Server (hapi v%s)running at: %s', server.version, server.info.uri);
    });
})

If I run node index.js, the output will look like

Server (hapi v11.1.4)running at: http://matthias.local:3000

This test ran on node v5.4.0 and npm 3.3.12. Can anyone confirm that behavior?

I guess glue's dependency "hapi": "11.x.x || 12.x.x" might be the problem. I'm not sure, if I understand how that resolves. Is it like »Take the latest version of hapi that satisfies 11.x.x OR 12.x.x«?

Maybe it's a better idea to add a peer-dependency for hapi like `"hapi": ">=11 <13"?

mtharrison commented 8 years ago

"hapi": "11.x.x || 12.x.x" is not in the package.json of the most recently published version (3.0.0). I think that still needs to be published.

mattiloh commented 8 years ago

Thanks Matt! That's really good to know :)

For a temporary fix I just added this git-repo as dependency to use the latest version. So it's working fine now. But maybe the peer-dependency could be worth to discuss for the next major release (I guess it would break current implementations which do not install hapi explicitly). What do you think about this?

nlindley commented 8 years ago

This was pretty confusing for me as well. I would suggest going the peer dependency route.

jppellerin commented 8 years ago

Unfortunately, I lost quite a bit of time with this as well. New hapi 12.X.X features not working. Was about to submit an issue with hapi to finally figure out that it was only when using glue that these issues were arising.

csrl commented 8 years ago

The NPM package page README shows only hapi 11 support. If you were referencing the github README, it pulls from master, which may be ahead of the released version. I guess this can be a common problem with viewing the source repository of a project, vs a release package.

csrl commented 8 years ago

v3.1.0 was just released with hapi 12 support.

mattiloh commented 8 years ago

Thanks @csrl!

jppellerin commented 8 years ago

@csrl Thanks for the update. That was indeed the problem, I was on the repo and not the package readme. Thanks for the new release.

lock[bot] commented 4 years ago

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.