Bug 1007272 - Failed to compile native code when installing websocket module on nodejs app
Summary: Failed to compile native code when installing websocket module on nodejs app
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Containers
Version: 2.x
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Mrunal Patel
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-09-12 08:23 UTC by Meng Bo
Modified: 2015-05-14 23:28 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-09-19 16:51:03 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Meng Bo 2013-09-12 08:23:12 UTC
Description of problem:
[websocket v1.0.8] Attempting to compile native extensions.
[websocket v1.0.8]
    Native code compile failed!!
    Please note that this module DOES NOT REQUIRE the native components
    and will still work without them, though not quite as efficiently.

    On Windows, native extensions require Visual Studio and Python.
    On Unix, native extensions require Python, make and a C++ compiler.
    Start npm with --websocket:verbose to show compilation output (if any).
websocket.8 node_modules/websocket

Met above failure when installing websocket module to nodejs app.

But all the required extensions should be installed on the node.


And the module can be installed on node without such failure.

[root@ip-10-151-119-174 ~]# npm install websocket
npm http GET https://registry.npmjs.org/websocket
npm http 200 https://registry.npmjs.org/websocket
npm http GET https://registry.npmjs.org/websocket/-/websocket-1.0.8.tgz
npm http 200 https://registry.npmjs.org/websocket/-/websocket-1.0.8.tgz

> websocket.8 install /root/node_modules/websocket
> node install.js

[websocket v1.0.8] Attempting to compile native extensions.
[websocket v1.0.8] Native extension compilation successful!
websocket.8 node_modules/websocket


Version-Release number of selected component (if applicable):
devenv_3776
openshift-origin-cartridge-nodejs-1.15.4-1.git.52.ef52f46.el6.noarch

How reproducible:
always

Steps to Reproduce:
1. Create a nodejs app
2. Add the following dependency into the package.json and git push
  "dependencies": {
        "websocket" : ">= 1.0.8"
  },
3. Or install the node module from gear repo dir directly in rhcsh
$ npm install websocket

Actual results:
Native code compile failed!!

Expected results:
Should not have such failure.

Additional info:

Comment 1 Mrunal Patel 2013-09-12 17:59:01 UTC
[nd4-testbz.dev.rhcloud.com websocket]\> node "/opt/rh/nodejs010/root/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp info it worked if it ends with ok
gyp info using node-gyp.5
gyp info using node.5 | linux | x64
gyp info spawn python
gyp info spawn args [ '/opt/rh/nodejs010/root/usr/bin/gyp',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/var/lib/openshift/5231fca0cde24de1fa000053/app-root/data/node_modules/websocket/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/opt/rh/nodejs010/root/usr/lib/node_modules/node-gyp/addon-rpm.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/opt/rh/nodejs010/root/usr/share/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/opt/rh/nodejs010/root/usr/share/node',
gyp info spawn args   '-Dmodule_root_dir=/var/lib/openshift/5231fca0cde24de1fa000053/app-root/data/node_modules/websocket',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
Traceback (most recent call last):
  File "/opt/rh/nodejs010/root/usr/bin/gyp", line 15, in <module>
    import gyp
ImportError: No module named gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/opt/rh/nodejs010/root/usr/lib/node_modules/node-gyp/lib/configure.js:417:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:784:12)
gyp ERR! System Linux 2.6.32-358.18.1.el6.x86_64
gyp ERR! command "node" "/opt/rh/nodejs010/root/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/lib/openshift/5231fca0cde24de1fa000053/app-root/data/node_modules/websocket
gyp ERR! node -v v0.10.5
gyp ERR! node-gyp -v v0.9.5
gyp ERR! not ok

Comment 2 Mrunal Patel 2013-09-12 18:24:56 UTC
https://github.com/openshift/origin-server/pull/3630

Note that the pull will fix the issue for nodejs-0.10 but won't fix it for nodejs-0.6 since the version of node-gyp that we have for 0.6 is too old.

Comment 3 Meng Bo 2013-09-13 06:23:23 UTC
Checked on devenv-stage_471, issue has been fixed for nodejs-0.10.

Move bug to verified.

remote: npm info install websocket.8
remote: 
remote: > websocket.8 install /var/lib/openshift/5232ae31e83eafa06600035a/app-root/runtime/repo/node_modules/websocket
remote: > node install.js
remote: 
remote: [websocket v1.0.8] Attempting to compile native extensions.
remote: [websocket v1.0.8] Native extension compilation successful!
remote: npm info postinstall websocket.8
remote: npm info build /var/lib/openshift/5232ae31e83eafa06600035a/app-root/runtime/repo
remote: npm info linkStuff OpenShift-Sample-App.0
remote: npm info install OpenShift-Sample-App.0
remote: npm info postinstall OpenShift-Sample-App.0
remote: npm info prepublish OpenShift-Sample-App.0
remote: websocket.8 node_modules/websocket
remote: npm info ok 
remote: Starting application no10
remote: Starting NodeJS cartridge


Note You need to log in before you can comment on or make changes to this bug.