OpenShift错误引用Bcrypt
问题描述:
我有我的应用程序在OpenShift近两个月,突然间我收到错误引用Bcrypt。直到上周,一切正常。我已经用尽了搜索,在等待麻烦回应时,想看看是否有其他人对此有任何问题。OpenShift错误引用Bcrypt
这里是我的依赖,我使用
“bcryptjs”: “〜2.3.0”,
Counting objects: 4, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 942 bytes | 0 bytes/s, done.
Total 4 (delta 1), reused 0 (delta 0)
remote: Stopping NodeJS cartridge
remote: Stopping PHPMyAdmin cartridge
remote: Repairing links for 1 deployments
remote: Saving away previously installed Node modules
remote: Building git ref 'master', commit 0470fcd
remote: Building NodeJS cartridge
remote: npm info it worked if it ends with ok
remote: npm info using [email protected]
remote: npm info using [email protected]
remote: npm info preinstall [email protected]
remote: npm info package.json [email protected] fs is also the name of a node core module.
remote: npm info package.json [email protected] No description
remote: npm info package.json [email protected] No repository field.
remote: npm info package.json [email protected] No README data
remote: npm info package.json [email protected] No license field.
remote: npm info package.json [email protected] No license field.
remote: npm info build /var/lib/openshift/57e0858289f5cf73ea0000bd/app-root/runtime/repo
remote: npm info linkStuff [email protected]
remote: npm info build /var/lib/openshift/57e0858289f5cf73ea0000bd/app-root/runtime/repo/node_modules/bcrypt
remote: npm info preinstall [email protected]
remote: npm info linkStuff [email protected]
remote: npm info install [email protected]
remote:
remote: > [email protected] install /var/lib/openshift/57e0858289f5cf73ea0000bd/app-root/runtime/repo/node_modules/bcrypt
remote: > node-gyp rebuild
remote:
remote: gyp info it worked if it ends with ok
remote: gyp info using [email protected]
remote: gyp info using [email protected] | linux | x64
remote: gyp info spawn /usr/bin/python2
remote: gyp info spawn args [ '/opt/rh/v8314/root/usr/bin/gyp',
remote: gyp info spawn args 'binding.gyp',
remote: gyp info spawn args '-f',
remote: gyp info spawn args 'make',
remote: gyp info spawn args '-I',
remote: gyp info spawn args '/var/lib/openshift/57e0858289f5cf73ea0000bd/app-root/runtime/repo/node_modules/bcrypt/build/config.gypi',
remote: gyp info spawn args '-I',
remote: gyp info spawn args '/opt/rh/nodejs010/root/usr/lib/node_modules/node-gyp/addon-rpm.gypi',
remote: gyp info spawn args '-I',
remote: gyp info spawn args '/opt/rh/nodejs010/root/usr/include/node/common.gypi',
remote: gyp info spawn args '-Dlibrary=shared_library',
remote: gyp info spawn args '-Dvisibility=default',
remote: gyp info spawn args '-Dnode_root_dir=/opt/rh/nodejs010/root/usr/share/node',
remote: gyp info spawn args '-Dnode_gyp_dir=/opt/rh/nodejs010/root/usr/lib/node_modules/node-gyp',
remote: gyp info spawn args '-Dnode_lib_file=node.lib',
remote: gyp info spawn args '-Dmodule_root_dir=/var/lib/openshift/57e0858289f5cf73ea0000bd/app-root/runtime/repo/node_modules/bcrypt',
remote: gyp info spawn args '--depth=.',
remote: gyp info spawn args '--generator-output',
remote: gyp info spawn args 'build',
remote: gyp info spawn args '-Goutput_dir=.' ]
remote: gyp info spawn make
remote: gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
remote: make: Entering directory `/var/lib/openshift/57e0858289f5cf73ea0000bd/app-root/runtime/repo/node_modules/bcrypt/build'
remote: make: Warning: File `../binding.gyp' has modification time 2e+02 s in the future
remote: ACTION Regenerating Makefile
remote: gyp: binding.gyp not found (cwd: /var/lib/openshift/57e0858289f5cf73ea0000bd/app-root/runtime/repo/node_modules/bcrypt/build) while trying to load binding.gyp
remote: make: *** [Makefile] Error 1
remote: make: Leaving directory `/var/lib/openshift/57e0858289f5cf73ea0000bd/app-root/runtime/repo/node_modules/bcrypt/build'
remote: gyp ERR! build error
remote: gyp ERR! stack Error: `make` failed with exit code: 2
remote: gyp ERR! stack at ChildProcess.onExit (/opt/rh/nodejs010/root/usr/lib/node_modules/node-gyp/lib/build.js:276:23)
remote: gyp ERR! stack at ChildProcess.emit (events.js:98:17)
remote: gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:820:12)
remote: gyp ERR! System Linux 2.6.32-642.6.2.el6.x86_64
remote: gyp ERR! command "node" "/opt/rh/nodejs010/root/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
remote: gyp ERR! cwd /var/lib/openshift/57e0858289f5cf73ea0000bd/app-root/runtime/repo/node_modules/bcrypt
remote: gyp ERR! node -v v0.10.35
remote: gyp ERR! node-gyp -v v3.2.0
remote: gyp ERR! not ok
remote:
remote: npm info [email protected] Failed to exec install script
remote: npm ERR! Linux 2.6.32-642.6.2.el6.x86_64
remote: npm ERR! argv "node" "/opt/rh/nodejs010/root/usr/bin/npm" "install" "-d
remote: npm ERR! node v0.10.35
remote: npm ERR! npm v2.14.13
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! [email protected] install: `node-gyp rebuild`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
remote: npm ERR! This is most likely a problem with the bcrypt package,
remote: npm ERR! not with npm itself.
remote: npm ERR! Tell the author that this fails on your system:
remote: npm ERR! node-gyp rebuild
remote: npm ERR! You can get their info via:
remote: npm ERR! npm owner ls bcrypt
remote: npm ERR! There is likely additional logging output above.
remote:
remote: npm ERR! Please include the following file with any support request:
remote: npm ERR! /var/lib/openshift/57e0858289f5cf73ea0000bd/app-root/runtime/repo/npm-debug.log
remote: An error occurred executing 'gear postreceive' (exit code: 1)
remote: Error message: CLIENT_ERROR: Failed to execute: 'control build' for /var/lib/openshift/57e0858289f5cf73ea0000bd/nodejs
remote:
remote: For more details about the problem, try running the command again with the '--trace' option.
我不知道为什么突然所有的我我收到这个错误。
答
你错误的本质是= /binding.gyp' has modification time 2e+02 s in the future
。
发生这种情况是因为您的Openshift容器在某种程度上系统时钟卡住了过去。
容易解决
最简单的办法是只修改bindings.gyp
文件的修改时间是,容器的。因此,在您Dockerfile,运行以下
RUN echo 'Getting current timestamp'
RUN date
RUN echo 'Getting timestamp of binding.gyp'
RUN stat -c %y binding.gyp
RUN touch -m binding.gyp
RUN npm install
长期修复
更好的解决办法是调查为什么你的容器有自己的时钟偏斜。用于Mac客户端的Docker有一个已知问题,当您的Mac进入睡眠状态时,容器的时钟发生偏斜= https://forums.docker.com/t/syncing-clock-with-host/10432/22