3rd-Eden / node-hashring

hashring is a consistent hashing algorithm for Node.js that is compatible with libketama and python's hash_ring package
MIT License
350 stars 57 forks source link

install in directory where parent directory has spaces #18

Closed julianbrowne closed 10 years ago

julianbrowne commented 10 years ago

There seems to be a known issue with node-gyp and installing in directories where the parents directories contain spaces: https://github.com/TooTallNate/node-gyp/issues/65. This certainly seems to be my case (works without spaces, fails with). The problem is in binding.gyp at:

'include_dirs': ["<!(node -p -e \"require('path').dirname(require.resolve('nan'))\")"]

A simple string replace in the node script looks to fix it:

{
  "targets": [
    {
      "target_name": "hashvalue",
      'include_dirs': ["<!(node -p -e \"require('path').dirname(require.resolve('nan')).replace(/ /g, '\\\\\ ')\")"],
      "sources": [ "src/hashvalue.cc" ]
    }
  ]
}
3rd-Eden commented 10 years ago

Is there any way we could write test against this?

julianbrowne commented 10 years ago

Or (just a thought) - that line is only there to find nan.h, which is always installed by npm relative to binding.gyp at node_modules/nan. So this works without any executable code at all:

{
  "targets": [
    {
      "target_name": "hashvalue",
      "include_dirs": ["node_modules/nan"],
      "sources": [ "src/hashvalue.cc" ]
    }
  ]
}

Better?