Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find module '../build/Debug/iconv.node' on OpenShift

I'm trying to deploy a Node.js Wiki called Jingo on OpenShift:

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

I've tried running node-gyp configure and node-gyp build at the command line but I do not have sufficient rights. I have also tried including node-gyp configure and node-gyp build in the package.json file as an install script but get the following error:

remote: > node-gyp configure; node-gyp build
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 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 [email protected]
remote: gyp info using [email protected] | 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 [email protected] Failed to exec install script
remote: npm ERR! [email protected] install: `node-gyp configure; node-gyp build`
remote: npm ERR! Exit status 1
remote: npm ERR!
remote: npm ERR! Failed at the [email protected] 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://[email protected]/~/git/jingo.git/
   f3b5d5e..db51a22  master -> master

Is there another way to install and configure node-gyp on OpenShift?

like image 734
Mark K Avatar asked Mar 19 '15 23:03

Mark K


1 Answers

My resolution for this issue is rebuilding iconv inside module folder manually, or by adding script install in package.json like

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

This will force rebuilding iconv.node after every automatic deployment by git push

UPD: Another approach is to add script in .openshift/action_hooks/build at the end of file:

# 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
like image 193
fir Avatar answered Sep 30 '22 04:09

fir