Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I was trying to install node.js on CentOS 6.4 VirtualBox guest on a Windows XP host with the following commands:

cd /usr/local/src/
git clone git://github.com/joyent/node.git
cd node
./configure
make
make install

I only reached as far as ./configure. When I executed ./configure I got the following errors:

Traceback (most recent call last):
File "./configure", line 14, in
<module> from gyp.common import GetFlavor
ImportError: No module named gyp.common
share|improve this question
    
+1 whereis python returns python: /usr/bin/python /usr/bin/python2.6 /usr/lib/python2.6 /usr/include/python2.6 /usr/share/man/man1/python.1.gz –  Anthony Jun 23 '13 at 23:17

3 Answers 3

what version of python do you have it installed. check python -V

before you run ./configure, make sure you have the following prerequisites completed.

* GCC 4.2 or newer
* Python 2.6 or 2.7
* GNU Make 3.81 or newer
* libexecinfo (FreeBSD and OpenBSD only)
share|improve this answer
    
+1 Thank you for your reply. python -V returns Python 2.6.6. I have gcc version 4.4.7 installed I have GNU Make 3.81 –  Anthony Jun 23 '13 at 23:24
    
However, I do not have libexecinfo installed. which libexecinfo displayed usr/bin/which: no libexecinfo in (/usr/local/:...) –  Anthony Jun 23 '13 at 23:25
2  
@Anthony - libexecinfo (FreeBSD and OpenBSD only) - you're on CentOS. –  don_crissti Jun 23 '13 at 23:37

The ./configure calls Python, which you already do have installed (the Traceback message is from a working Python).

I just did a fresh git checkout of and it configures with both python 2.6 and 2.7.

What ./configure is failing to find is Generate Your Progject, which should be included in the tools/gyp directory. If those files are not there, git might have missed a beat.

This can also be caused by a different gyp module, than the one provided in node.js, being found by python. To check that you can do

$ python
>>> import gyp
>>> print gyp.__file__

if you don't get an 'ImportError' this shows you which file Python actually imports.

share|improve this answer

I think something is either wrong with your clone copy of node.js or something is up with the mix of packages you have installed on your CentOS 6.4 box. I have that same distro here and I just did the same steps you did and it worked.

$ ./configure
{ 'target_defaults': { 'cflags': [],
                       'default_configuration': 'Release',
                       'defines': [],
                       'include_dirs': [],
                       'libraries': []},
  'variables': { 'clang': 0,
                 'gcc_version': 44,
                 'host_arch': 'x64',
                 'node_install_npm': 'true',
                 'node_prefix': '',
                 'node_shared_cares': 'false',
                 'node_shared_http_parser': 'false',
                 'node_shared_libuv': 'false',
                 'node_shared_openssl': 'false',
                 'node_shared_v8': 'false',
                 'node_shared_zlib': 'false',
                 'node_tag': '',
                 'node_unsafe_optimizations': 0,
                 'node_use_dtrace': 'false',
                 'node_use_etw': 'false',
                 'node_use_openssl': 'true',
                 'node_use_perfctr': 'false',
                 'node_use_systemtap': 'false',
                 'python': '/usr/bin/python',
                 'target_arch': 'x64',
                 'v8_enable_gdbjit': 0,
                 'v8_no_strict_aliasing': 1,
                 'v8_use_snapshot': 'true'}}
creating  ./config.gypi
creating  ./config.mk

As @Anthon suggested I ran the following commands and I don't even have the gyp.common Python package installed either when I ran the above ./configure command, and yet it worked fine.

$ python
Python 2.6.6 (r266:84292, Feb 22 2013, 00:00:18) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gyp
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named gyp

So I'm not really sure what's going on with your environment. I would debug it a little bit further and take a look at your $PATH and $LD_LIBRARY_PATH environment variables to determine if you're getting the version of Python that you think you are.

workaround

If you don't require the latest node.js you can just install it from the yum repositories for CentOS 6.4. Most of the Node.js toolset is already pre-built for you in the EPEL repository, which you should have by default. So just run this command to install it:

$ sudo yum install nodejs

All the other packages are available if you do search for nodejs.

$ yum search nodejs
Loaded plugins: fastestmirror, priorities, refresh-packagekit
Loading mirror speeds from cached hostfile
 * base: mirrors.liquidweb.com
 * epel: mirror.steadfast.net
 * extras: mirror.thelinuxfix.com
 * updates: centos.mbni.med.umich.edu
73 packages excluded due to repository priority protections
======================================================= N/S Matched: nodejs ========================================================
nodejs-burrito.noarch : Wrap up expressions with a trace function while walking the AST
nodejs-delayed-stream.noarch : Buffers events from a stream until you are ready to handle them
nodejs-npm-registry-client.noarch : Client for the npm registry
nodejs-options.noarch : Light-weight in-code option parser for nodejs
nodejs-osenv.noarch : Look up environment settings specific to different operating systems
...
...
share|improve this answer
    
It is actually good that your import gyp does throw an error. I have a suspicion that the OP has some gyp in his Python package search path that gets included before the one in the node.js source tree. –  Anthon Jun 27 '13 at 20:14
    
@Anthon - that's what I suspected as well. You're more versed in Python than I, so I didn't want to jump to a conclusion. –  slm Jun 27 '13 at 20:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.