urbica / galton

Lightweight Node.js isochrone map server
https://galton.urbica.co
MIT License
272 stars 36 forks source link

OSRM 5.19.0 compatibility #231

Open mvl22 opened 5 years ago

mvl22 commented 5 years ago

Is there any compatibility possible yet with OSRM 5.19.0? With various combinations I cannot get this to work:

Using the released version of Galton, an incompatibility error is noted:

> node_modules/galton/index.js  /path/to/data.osrm
TypeError: File is incompatible with this version of OSRM: /path/to/merged.osrm.icd prepared with OSRM 5.19.0 but this is v5.18.0 (at include/storage/tar.hpp:204)

Upgrading to galton@5.19.0-beta.2 (with nvm use 8.0) gives:

/path/to/node_modules/galton/src/commands/utils.js:11
          ...selectShellOptions
          ^^^

SyntaxError: Unexpected token ...
    at createScript (vm.js:74:10)
    at Object.runInThisContext (vm.js:116:10)
    at Module._compile (module.js:533:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/path/to/node_modules/galton/src/commands/extract.js:7:20)

Using galton@5.19.0-beta.2 (with nvm use 10.0 instead) gives an install error:

$ npm install galton@5.19.0-beta.2

> osrm@5.19.0 install /path/to/node_modules/osrm
> node-pre-gyp install --fallback-to-build=false || ./scripts/node_install.sh

node-pre-gyp ERR! install error
node-pre-gyp ERR! stack Error: 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/osrm/v5.19.0/Release/node-v64-linux-x64.tar.gz
node-pre-gyp ERR! stack     at Request.<anonymous> (/wpath/to/node_modules/osrm/node_modules/node-pre-gyp/lib/install.js:118:27)
node-pre-gyp ERR! stack     at Request.emit (events.js:187:15)
node-pre-gyp ERR! stack     at Request.onRequestResponse (/path/to/node_modules/osrm/node_modules/request/request.js:1074:10)
node-pre-gyp ERR! stack     at ClientRequest.emit (events.js:182:13)
node-pre-gyp ERR! stack     at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:534:21)
node-pre-gyp ERR! stack     at HTTPParser.parserOnHeadersComplete (_http_common.js:109:17)
node-pre-gyp ERR! stack     at TLSSocket.socketOnData (_http_client.js:421:20)
node-pre-gyp ERR! stack     at TLSSocket.emit (events.js:182:13)
node-pre-gyp ERR! stack     at addChunk (_stream_readable.js:280:12)
node-pre-gyp ERR! stack     at readableAddChunk (_stream_readable.js:265:11)
node-pre-gyp ERR! System Linux 4.15.0-38-generic
node-pre-gyp ERR! command "/home/myUsername/.nvm/versions/node/v10.0.0/bin/node" "/path/to/node_modules/osrm/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build=false"
node-pre-gyp ERR! cwd /path/to/node_modules/osrm
node-pre-gyp ERR! node -v v10.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok
403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/osrm/v5.19.0/Release/node-v64-linux-x64.tar.gz
/path/to/node_modules/osrm/build /path/to/node_modules/osrm
CMake Error: The source directory "/path/to/node_modules/osrm" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
npm WARN enoent ENOENT: no such file or directory, open '/path/to/package.json'
npm WARN myDomain No description
npm WARN myDomain No repository field.
npm WARN myDomain No README data
npm WARN myDomain No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! osrm@5.19.0 install: `node-pre-gyp install --fallback-to-build=false || ./scripts/node_install.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the osrm@5.19.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/myUsername/.npm/_logs/2019-02-11T18_35_43_808Z-debug.log
stepankuzmin commented 5 years ago

Hey @mvl22! What is your version of Node?

mvl22 commented 5 years ago

See above - either "nvm use 8.0" or "nvm use 10.0" in those examples. I'm not sure off-hand what I was using in the first example.

mvl22 commented 5 years ago

Just to confirm that things work fine on my set up if I downgrade to OSRM 5.17.2 (under Node 8) and use the Galton 5.17.2 release. I'll have another go shortly with a clean setup in case there was something odd, but it would be useful to know whether the latest release or the current HEAD of master is intended to be compatible with OSRM 5.19.0.

mvl22 commented 4 years ago

On an Ubuntu 20.04 LTS install, the only combination I can get this to install remains the following, not as root:

# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash

# Use nvm immediately
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm

# Use Node.js v. 8 (i.e. v8.17.0)
nvm install 8
nvm use 8

# Install Galton
npm install galton@5.17.2

(Note that this gives you node v8.17.0, which seems to work, whereas 8.0.0 does not.)

NB: Doing the same but with node 10 rather than 8 in the above gives: Error: 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/osrm/v5.17.2/Release/node-v64-linux-x64.tar.gz and subsequent errors. (v64 in that URL presumably relates to the node module version.)

E.g. to install as a particular user, e.g. routing, you would use the following as root:

su - routing -c "curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.36.0/install.sh | bash"

su - routing -c 'export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && nvm install 8 && nvm use 8 && npm install galton@v5.17.2'