afloyd / mongo-migrate

MIT License
159 stars 81 forks source link

Can't launch migrations inside Docker #76

Open hugree opened 5 years ago

hugree commented 5 years ago

I'm using the following commands to launch the migrations

npm install -g migrate-mongo
npm i mongodb
node migrate-mongo status
node migrate-mongo up

When I run it locally from insider my Dockerfile, which is based on docker:18.05.0-ce and has npm installed with RUN apk add nodejs nodejs-npm make gcc g++ python libgcc libstdc++ everything works fine.

When I launch it on bitbucket pipelines I have the following error

+ migrate-mongo@4.1.2
added 23 packages in 1.673s
> bcrypt@3.0.1 install /opt/atlassian/pipelines/agent/build/app/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using request for node-pre-gyp https download 
node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.1/bcrypt_lib-v3.0.1-node-v57-linux-x64-musl.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for bcrypt@3.0.1 and node@8.9.3 (node-v57 ABI, musl) (falling back to source compile with node-gyp) 
gyp WARN EACCES user "undefined" does not have permission to access the dev dir "/root/.node-gyp/8.9.3"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/opt/atlassian/pipelines/agent/build/app/node_modules/bcrypt/.node-gyp"
make: Entering directory '/opt/atlassian/pipelines/agent/build/app/node_modules/bcrypt/build'
make: Leaving directory '/opt/atlassian/pipelines/agent/build/app/node_modules/bcrypt/build'
make: *** No rule to make target '../.node-gyp/8.9.3/include/node/common.gypi', needed by 'Makefile'.  Stop.
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/opt/atlassian/pipelines/agent/build/app/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
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.14.63-coreos
gyp ERR! command "/usr/bin/node" "/opt/atlassian/pipelines/agent/build/app/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/opt/atlassian/pipelines/agent/build/app/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/opt/atlassian/pipelines/agent/build/app/node_modules/bcrypt/lib/binding" "--napi_version=1" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v57"
gyp ERR! cwd /opt/atlassian/pipelines/agent/build/app/node_modules/bcrypt
gyp ERR! node -v v8.9.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /opt/atlassian/pipelines/agent/build/app/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/opt/atlassian/pipelines/agent/build/app/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/opt/atlassian/pipelines/agent/build/app/node_modules/bcrypt/lib/binding --napi_version=1 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v57' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/opt/atlassian/pipelines/agent/build/app/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:925:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Linux 4.14.63-coreos
node-pre-gyp ERR! command "/usr/bin/node" "/opt/atlassian/pipelines/agent/build/app/node_modules/bcrypt/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /opt/atlassian/pipelines/agent/build/app/node_modules/bcrypt
node-pre-gyp ERR! node -v v8.9.3
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok 
Failed to execute '/usr/bin/node /opt/atlassian/pipelines/agent/build/app/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/opt/atlassian/pipelines/agent/build/app/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/opt/atlassian/pipelines/agent/build/app/node_modules/bcrypt/lib/binding --napi_version=1 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v57' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt@3.0.1 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the bcrypt@3.0.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Has anyone else faced a similar problem?