在OpenShift上找不到模块'../build/Debug/iconv.node'

我试图在OpenShift上部署一个叫做Jingo的Node.js Wiki:

Error: Cannot find module '../build/Debug/iconv.node' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.<anonymous> (/var/lib/openshift/550a72cf5973cac5c10000ca/app-root/runtime/repo/node_modules/icon at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) DEBUG: Program node jingo -c config.yaml exited with code 8 

我试过在命令行上运行node-gyp configure和node-gyp build,但是我没有足够的权限。 我也试过在package.json文件中包含node-gyp configure和node-gyp build作为安装脚本,但是得到以下错误:

 remote: > node-gyp configure; node-gyp build remote: remote: gyp info it worked if it ends with ok remote: gyp info using node-gyp@0.12.2 remote: gyp info using node@0.10.25 | linux | x64 remote: gyp info spawn python 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/550a72cf5973cac5c10000ca/app-root/runtime/repo/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/share/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 '-Dmodule_root_dir=/var/lib/openshift/550a72cf5973cac5c10000ca/app-root/runtime/repo', 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: binding.gyp not found (cwd: /var/lib/openshift/550a72cf5973cac5c10000ca/app-root/runtime/repo) while trying to load binding.gyp remote: gyp ERR! configure error remote: gyp ERR! stack Error: `gyp` failed with exit code: 1 remote: gyp ERR! stack at ChildProcess.onCpExit (/opt/rh/nodejs010/root/usr/lib/node_modules/node-gyp/lib/configure.js:338:16) remote: gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17) remote: gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12) remote: gyp ERR! System Linux 2.6.32-504.3.3.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" "configure" remote: gyp ERR! cwd /var/lib/openshift/550a72cf5973cac5c10000ca/app-root/runtime/repo remote: gyp ERR! node -v v0.10.25 remote: gyp ERR! node-gyp -v v0.12.2 remote: gyp ERR! not ok remote: gyp info it worked if it ends with ok remote: gyp info using node-gyp@0.12.2 remote: gyp info using node@0.10.25 | linux | x64 remote: gyp info spawn make remote: gypmake: Entering directory `/var/lib/openshift/550a72cf5973cac5c10000ca/app-root/runtime/repo/build' remote: make: Leaving directory `/var/lib/openshift/550a72cf5973cac5c10000ca/app-root/runtime/repo/build' remote: info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ] remote: make: *** No targets specified and no makefile found. Stop. 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:267:23) remote: gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17) remote: gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12) remote: gyp ERR! System Linux 2.6.32-504.3.3.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" "build" remote: gyp ERR! cwd /var/lib/openshift/550a72cf5973cac5c10000ca/app-root/runtime/repo remote: gyp ERR! node -v v0.10.25 remote: gyp ERR! node-gyp -v v0.12.2 remote: gyp ERR! not ok remote: remote: npm info jingo@1.2.6 Failed to exec install script remote: npm ERR! jingo@1.2.6 install: `node-gyp configure; node-gyp build` remote: npm ERR! Exit status 1 remote: npm ERR! remote: npm ERR! Failed at the jingo@1.2.6 install script. remote: npm ERR! This is most likely a problem with the jingo 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 configure; node-gyp build remote: npm ERR! You can get their info via: remote: npm ERR! npm owner ls jingo remote: npm ERR! There is likely additional logging output above. remote: npm ERR! System Linux 2.6.32-504.3.3.el6.x86_64 remote: npm ERR! command "node" "/opt/rh/nodejs010/root/usr/bin/npm" "install" "-d" remote: npm ERR! cwd /var/lib/openshift/550a72cf5973cac5c10000ca/app-root/runtime/repo remote: npm ERR! node -v v0.10.25 remote: npm ERR! npm -v 1.3.24 remote: npm ERR! code ELIFECYCLE remote: npm ERR! remote: npm ERR! Additional logging details can be found in: remote: npm ERR! /var/lib/openshift/550a72cf5973cac5c10000ca/app-root/runtime/repo/npm-debug.log remote: npm ERR! not ok code 0 remote: An error occurred executing 'gear postreceive' (exit code: 1) remote: Error message: CLIENT_ERROR: Failed to execute: 'control build' for /var/lib/openshift/550a72cf5973cac5c10000ca/nodejs remote: remote: For more details about the problem, try running the command again with the '--trace' option. To ssh://550a72cf5973cac5c10000ca@jingo-docusignau.rhcloud.com/~/git/jingo.git/ f3b5d5e..db51a22 master -> master 

有没有另一种方法来在OpenShift上安装和configurationnode-gyp?

Solutions Collecting From Web of "在OpenShift上找不到模块'../build/Debug/iconv.node'"

我对这个问题的解决scheme是手动重build模块文件夹内的iconv,或者像在package.json添加脚本install

  "scripts": { "start": "node server.js", "install": "cd node_modules/iconv; node-gyp rebuild" } 

这将强制每次通过git push自动部署后重buildiconv.node

UPD:另一种方法是在文件末尾的.openshift/action_hooks/build中添加脚本:

 # rebuilding iconv if [ -f "${OPENSHIFT_REPO_DIR}/node_modules/iconv"/package.json ]; then echo " - Rebuilding iconv ... " echo (cd "${OPENSHIFT_REPO_DIR}/node_modules/iconv/"; node-gyp rebuild) fi