Issue encountered during an attempt to set up polisServer on Ubuntu 18.04.3 LTS (GNU/Linux 4.15.0-66-generic x86_64) according to the instructions in the readme.
The first steps go well (smoothly, even!) but npm install throws up this:
gyp: Call to '/usr/bin/pg_config --libdir' returned exit status 1 while in binding.gyp. while 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 (/root/.nvm/versions/node/v10.9.0/lib/node_modules/npm/node_modules/node-
gyp/lib/configure.js:345:16)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:239:12)
gyp ERR! System Linux 4.15.0-66-generic
gyp ERR! command "/root/.nvm/versions/node/v10.9.0/bin/node"
"/root/.nvm/versions/node/v10.9.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /opt/polisServer/node_modules/libpq
gyp ERR! node -v v10.9.0
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY:
polisServerBrand@git+https://github.com/colinmegill/polisServerBrand.git#master (node_modules/polisServerBrand):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Error while executing:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: /usr/bin/git ls-remote -h -t
https://github.com/colinmegill/polisServerBrand.git
npm WARN optional SKIPPING OPTIONAL DEPENDENCY:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: remote: Invalid username or password.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fatal: Authentication failed for
'https://github.com/colinmegill/polisServerBrand.git/'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: exited with error code: 128
npm WARN [email protected] No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
Uninstalling node-gyp and retrying gives the same error:
rm -r ~/.node-gyp/
rm -r /opt/polisServer/node_modules/
Running the offending command:
/root/.nvm/versions/node/v10.9.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js rebuild
threw up the following interesting error:
gyp: Undefined variable module_name in binding.gyp while trying to load binding.gyp
Optimistically trying to run ./x fails too, with this error:
internal/modules/cjs/loader.js:583
throw err;
^
Error: Cannot find module '/opt/polisServer/node_modules/bcrypt/lib/binding/bcrypt_lib.node'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/opt/polisServer/node_modules/bcrypt/bcrypt.js:6:16)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/opt/polisServer/server.js:18:16)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
Am getting the same error.
The bcrypt version in package.json is failing to install
You can replace this line in package.json
"bcrypt": "3.0.0",
to this
"bcrypt": "https://github.com/kelektiv/node.bcrypt.js.git#master",
then run npm install again
Python is also a requirement
Kenbok - thanks for raising that. Didn't fix the issue for me, but I've eventually managed to get npm install working. As above, it looks like there are some extra requirements.
From a fresh Ubuntu 18.04.3 instance, I needed to run:
apt install python libpq-dev make g++
which seems to fix things
Update - while the above gets npm install to run, the server still doesn't start until package.json is updated as per Kenbok's comment above
I think we can close this now that we've got Dockerfiles as the canonical how-to :)
Update - while the above gets
npm installto run, the server still doesn't start untilpackage.jsonis updated as per Kenbok's comment above
Work for me. Thanks !!!