mapbox / node-or-tools

Node.js bindings for or-tools vehicle routing problems
MIT License
147 stars 48 forks source link

NPM install #25

Closed harshw closed 7 years ago

harshw commented 7 years ago

Hello, Trying to do an "npm install node_or_tools" on a SunOS 5.11 Linux machine but running into some errors. Have installed globally the "node-pre-gyp" package and "node-gyp" package. Here are the initial build errors...Does the node version have to be 4.8? I have installed Node 6.9.2 and NPM 5.0.3.

Thanks in advance for any help.

node_or_tools@1.0.3 install /home/routing/node_modules/node_or_tools node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazon s.com/node_or_tools/v1.0.3/Release/node-v48-sunos-x64.tar.gz node-pre-gyp ERR! Pre-built binaries not found for node_or_tools@1.0.3 and nod 6.9.2 (node-v48 ABI) (falling back to source compile with node-gyp) gyp: binding.gyp not found (cwd: /home/routing/node_modules/node_or_tools) whi trying to load binding.gyp gyp ERR! configure error gyp ERR! stack Error: gyp failed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (/home/routing/node_modules/node-g /lib/configure.js:336:16) gyp ERR! stack at emitTwo (events.js:106:13) gyp ERR! stack at ChildProcess.emit (events.js:191:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_proc s.js:215:12) gyp ERR! System SunOS 5.11 gyp ERR! command "/opt/local/bin/node" "/home/routing/node_modules/node-gyp/bi node-gyp.js" "configure" "--fallback-to-build" "--module=/home/routing/node_mo les/node_or_tools/lib/binding/node_or_tools.node" "--module_name=node_or_tools "--module_path=/home/routing/node_modules/node_or_tools/lib/binding" gyp ERR! cwd /home/routing/node_modules/node_or_tools gyp ERR! node -v v6.9.2 gyp ERR! node-gyp -v v3.6.2 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute '/opt/local/bin/node /home/ro ing/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --modu =/home/routing/node_modules/node_or_tools/lib/binding/node_or_tools.node --mod e_name=node_or_tools --module_path=/home/routing/node_modules/node_or_tools/li binding' (1) node-pre-gyp ERR! stack at ChildProcess. (/home/routing/node_mo les/node_or_tools/node_modules/node-pre-gyp/lib/util/compile.js:83:29) node-pre-gyp ERR! stack at emitTwo (events.js:106:13) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:191:7) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:877:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/c ld_process.js:226:5) node-pre-gyp ERR! System SunOS 5.11 node-pre-gyp ERR! command "/opt/local/bin/node" "/home/routing/node_modules/no _or_tools/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd /home/routing/node_modules/node_or_tools node-pre-gyp ERR! node -v v6.9.2 node-pre-gyp ERR! -v v0.6.36 node-pre-gyp ERR! not ok Failed to execute '/opt/local/bin/node /home/routing/node_modules/node-gyp/bin ode-gyp.js configure --fallback-to-build --module=/home/routing/node_modules/n e_or_tools/lib/binding/node_or_tools.node --module_name=node_or_tools --module ath=/home/routing/node_modules/node_or_tools/lib/binding' (1)

Saspect-IO commented 7 years ago

Please chack this link for setup and anything you may have missed in your initial setup of node and npm. http://blog.teamtreehouse.com/install-node-js-npm-linux Then try your npm install node_or_tools

harshw commented 7 years ago

Thanks for the quick response! We have tried installing the node-or-tool on a running production node app environment and also a clean install on the latest node and npm version that was mentioned in the orignial issue with the same errrors. Is there a dependency specific to node 4.8 version to take advantage of the prebuilt libraries? We have node 6.9.2. Anything specific to pre-gyp or gyp also that we need to install? The errors are saying that "node-pre-gyp install --fallback-to-build" is failing.

daniel-j-h commented 7 years ago

We build and publish binaries for LTS Node.js 4 and 6 - but only for Linux and macOS.

node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazon
s.com/node_or_tools/v1.0.3/Release/node-v48-sunos-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for node_or_tools@1.0.3 and nod
6.9.2 (node-v48 ABI) (falling back to source compile with node-gyp)

This roughly says: there is no SunOS pre-built binary and building from source seems to fail on your system. What you can try is posting the installation log in verbose mode when building from source:

env V=1 npm install --build-from-source
harshw commented 7 years ago

Thank you for your suggestion. I have tried a number of things according to the more verbose error log but it is still failing. I have attached the verbose log. Appreciate the help to clarify what might be going on.

2017-07-13T01_09_42_634Z-debug.txt

daniel-j-h commented 7 years ago

Hm all I can see in your log is the following error log

1980 info lifecycle node_or_tools@1.0.3~install: node_or_tools@1.0.3
1981 verbose lifecycle node_or_tools@1.0.3~install: unsafe-perm in lifecycle true
1982 verbose lifecycle node_or_tools@1.0.3~install: PATH: /opt/local/lib/node_modules/npm/bin/node-gyp-bin:/home/routing/node_modules/node_or_tools/node_modules/.bin:/home/routing/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/opt/local/sbin:/opt/local/bin:/usr/sbin:/usr/bin:/sbin
1983 verbose lifecycle node_or_tools@1.0.3~install: CWD: /home/routing/node_modules/node_or_tools
1984 silly lifecycle node_or_tools@1.0.3~install: Args: [ '-c', 'node-pre-gyp install --fallback-to-build' ]
1985 silly lifecycle node_or_tools@1.0.3~install: Returned: code: 1  signal: null
1986 info lifecycle node_or_tools@1.0.3~install: Failed to exec install script
1987 verbose unlock done using /root/.npm/_locks/staging-6d8364e01a125c5a.lock for /home/routing/node_modules/.staging
1988 warn routing@1.0.0 No description
1989 warn routing@1.0.0 No repository field.
1990 verbose stack Error: node_or_tools@1.0.3 install: `node-pre-gyp install --fallback-to-build`
1990 verbose stack Exit status 1
1990 verbose stack     at EventEmitter.<anonymous> (/opt/local/lib/node_modules/npm/lib/utils/lifecycle.js:283:16)
1990 verbose stack     at emitTwo (events.js:106:13)
1990 verbose stack     at EventEmitter.emit (events.js:191:7)
1990 verbose stack     at ChildProcess.<anonymous> (/opt/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
1990 verbose stack     at emitTwo (events.js:106:13)
1990 verbose stack     at ChildProcess.emit (events.js:191:7)
1990 verbose stack     at maybeClose (internal/child_process.js:877:16)
1990 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
1991 verbose pkgid node_or_tools@1.0.3
1992 verbose cwd /home/routing
1993 verbose SunOS 5.11
1994 verbose argv "/opt/local/bin/node" "/opt/local/bin/npm" "install" "--build-from-source" "node_or_tools" "--unsafe-perm=true"
1995 verbose node v6.9.2
1996 verbose npm  v5.0.3

paging @springmeyer for node-pre-gyp help - do you have seen anything like that before?

@harshw can you give us some more details, what compiler are you using, which version is it? Given that this is SunOS and we don't have much experience here I don't know if we can help you here.

harshw commented 7 years ago

I have copied from the terminal both the compiler and make versions on my system. Can I force a compile through some manual switches on node-pre-gyp?

gcc (GCC) 4.9.4 Copyright (C) 2015 Free Software Foundation, Inc.

GNU Make 4.1 Built for x86_64-sun-solaris2.11 Copyright (C) 1988-2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html

springmeyer commented 7 years ago

@harshw I'm sorry, node-or-tools does not support sunos. If you want to use node-or-tools I recommend you move to linux or OS X. For this reason I will now close this issue. Please create a new issue if you have any trouble installing on OS X or Linux. On those systems we support binaries for both node v4 and v6, so both should work great and be easy to install. Let us know if you find otherwise.

The reason is that node-or-tools does not support sunos is that this module depends on external libraries that must be pre-compiled for a given architecture: these are gflags, libprotobuf, and libortools (and all of its dependencies). Two blockers exist:

daniel-j-h commented 7 years ago

@springmeyer wondering if and how we can get more verbose log messages out of node-pre-gyp. Even with the verbose flag turned on all I can see is: it's bailing out, but I don't know where or why specifically.

(just interested here - you are right SunOS will not work without libortools.so)

springmeyer commented 7 years ago

@harshw I'm sorry: I forgot to mention that, while I know we don't support sunos and that is the root cause, I'm unsure why you are getting such a cryptic error.

1990 verbose stack Error: node_or_tools@1.0.3 install: `node-pre-gyp install --fallback-to-build`
1990 verbose stack Exit status 1

^^ That obviously does not provide much to go on. What is likely happening is that the build system calls out to the https://github.com/mapbox/node-or-tools/blob/master/scripts/install-deps.sh file from https://github.com/mapbox/node-or-tools/blob/master/binding.gyp#L12-L23. That call out is failing because mason does not support sunos. Locally I'm currently trying to figure out why this is not producing a better error. Will post back when I know more.

springmeyer commented 7 years ago

I'm unable to replicate the obscure error. Rather I get a different error that is both expected and can be improved. What I did is changed third_party/mason/mason.sh to hardcode sunos

- MASON_UNAME=`uname -s`
+ MASON_UNAME="sunos"

Here: https://github.com/mapbox/mason/blob/4da5ec441b9bad3aa546c414b519fee611a77e4d/mason.sh#L9

That simulates running sunos. Then I built from source, expecting an error from mason to trickle up to the terminal. It did:

$ V=1 npm install --build-from-source
npm WARN prefer global node-gyp@3.5.0 should be installed with -g

> node_or_tools@1.0.3 install /Users/dane/projects/node-or-tools
> node-pre-gyp install --fallback-to-build

gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
  LD_LIBRARY_PATH=/Users/dane/projects/node-or-tools/build/Release/lib.host:/Users/dane/projects/node-or-tools/build/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../.; mkdir -p .; ./scripts/install-deps.sh
/Users/dane/projects/node-or-tools/third_party/mason/mason.sh: line 41: MASON_PLATFORM: unbound variable
make: *** [mason_packages] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/dane/projects/node-or-tools/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:12)
gyp ERR! System Darwin 16.6.0
gyp ERR! command "/Users/dane/.nvm/versions/node/v4.8.3/bin/node" "/Users/dane/projects/node-or-tools/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/dane/projects/node-or-tools/lib/binding/node_or_tools.node" "--module_name=node_or_tools" "--module_path=/Users/dane/projects/node-or-tools/lib/binding"
gyp ERR! cwd /Users/dane/projects/node-or-tools
gyp ERR! node -v v4.8.3
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok 

The /Users/dane/projects/node-or-tools/third_party/mason/mason.sh: line 41: MASON_PLATFORM: unbound variable is the key error here and the expected one. Since mason does not support sunos. Although it is also pretty unhelpful, so I've ticketed improving this at https://github.com/mapbox/mason/issues/448.

harshw commented 7 years ago

Thank you for your help on this! We have successfully installed the node-or-tools on an Ubuntu instance. Again, appreciate the thoughtful support.