No module named gyp.common

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

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.

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
...
...

本文出自 全栈笔记 版权所有,你可以在保留原文地址:No module named gyp.common 及作者的情况下到你的网站或博客。

【上一篇】
【下一篇】

您可能感兴趣的文章:

发表评论

您必须 登录 后才能发表评论。