Im trying to run ānpm install couchbaseā inside a docker container.
When running inside a directory that is a binding mount I get the following error thrown.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! couchbase@2.6.0 install:prebuild-install || node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the couchbase@2.6.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! /root/.npm/_logs/2018-10-18T12_04_08_602Z-debug.log
and further up
fs.js:646
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^Error: EINVAL: invalid argument, open ā/workload/node_modules/couchbase/package.jsonā
at Object.fs.openSync (fs.js:646:18)
at Object.fs.readFileSync (fs.js:551:33)
at Object.Module._extensionsā¦json (module.js:670:20)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object. (/workload/node_modules/couchbase/node_modules/napi-build-utils/index.js:5:11)
at Module._compile (module.js:653:30)
module.js:550
throw err;
^Error: Cannot find module ānanā
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at [eval]:1:1
at ContextifyScript.Script.runInThisContext (vm.js:50:33)
at Object.runInThisContext (vm.js:139:38)
at Object. ([eval]-wrapper:6:22)
at Module._compile (module.js:653:30)
at evalScript (bootstrap_node.js:479:27)
gyp: Call to ānode -e ārequire(ānanā)āā 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 (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.9.125-linuxkit
gyp ERR! command ā/usr/local/bin/nodeā ā/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.jsā ārebuildā
gyp ERR! cwd /workload/node_modules/couchbase
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
When running in non binding mount aka native container directory or docker volume everything works as expected.
Using yarn to install the package works just fine when used with binding mounts.
Host OS: Windows 10 Pro 1803
Docker: latest stable / edge
Node/NPM images: node:8, node:10
So because Yarn works pretty fine and as expected, it has to be an issue of NPM, and not about the environment or docker I think.