2012-08-04 441 views
1

我在安装节点iconv时出现问题。通过npm安装节点iconv失败

这是当我尝试在一个目录〜/请工作来安装它会发生什么/

please-work >> npm install iconv 
npm http GET https://registry.npmjs.org/iconv 
npm http 304 https://registry.npmjs.org/iconv 

> [email protected] install /Users/j/please-work/node_modules/iconv 
> node-gyp rebuild 

CC(target) Release/obj.target/iconv/deps/libiconv/libcharset/lib/localcharset.o 
CC(target) Release/obj.target/iconv/deps/libiconv/lib/iconv.o 
In file included from ../deps/libiconv/lib/iconv.c:71: 
In file included from ../deps/libiconv/lib/converters.h:133: 
../deps/libiconv/lib/utf7.h:162:13: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare] 
    if (n < count+base64count+1) 
     ~^~~~~~~~~~~~~~~~~~~~ 
../deps/libiconv/lib/utf7.h:331:11: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare] 
if (n < count) 
    ~^~~~~~ 

....然后继续这样下去了过长...时间

然后结束与此...

620 warnings generated. 
    CXX(target) Release/obj.target/iconv/binding.o 
    SOLINK_MODULE(target) Release/iconv.node 
    File "./gyp-mac-tool", line 159 
    fd = os.open(lockfile, os.O_RDONLY|os.O_NOCTTY|os.O_CREAT, 0o666) 
                   ^
SyntaxError: invalid syntax 
make: *** [Release/iconv.node] Error 1 
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2 
gyp ERR! stack  at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:215:23) 
gyp ERR! stack  at ChildProcess.EventEmitter.emit (events.js:91:17) 
gyp ERR! stack  at Process._handle.onexit (child_process.js:674:10) 
gyp ERR! System Darwin 11.4.0 
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" 
gyp ERR! cwd /Users/j/please-work/node_modules/iconv 
gyp ERR! node -v v0.8.5 
gyp ERR! node-gyp -v v0.6.3 
gyp ERR! not ok 
npm ERR! [email protected] install: `node-gyp rebuild` 
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1 
npm ERR! 
npm ERR! Failed at the [email protected] install script. 
npm ERR! This is most likely a problem with the iconv package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  node-gyp rebuild 
npm ERR! You can get their info via: 
npm ERR!  npm owner ls iconv 
npm ERR! There is likely additional logging output above. 

npm ERR! System Darwin 11.4.0 
npm ERR! command "node" "/usr/local/bin/npm" "install" "iconv" 
npm ERR! cwd /Users/j/please-work 
npm ERR! node -v v0.8.5 
npm ERR! npm -v 1.1.46 
npm ERR! code ELIFECYCLE 
npm ERR! 
npm ERR! Additional logging details can be found in: 
npm ERR!  /Users/j/please-work/npm-debug.log 
npm ERR! not ok code 0 

任何帮助将非常感激! 谢谢, -J

回答

3

iconv的作者指出我可能运行了python的错误版本。

一旦我安装了Python 2.7.3就没事了。

+0

很高兴你想通了! – rdrey 2012-08-05 23:00:29

2

看起来有一些图书馆iconv取决于问题,但是编译器警告,大概可以忽略不计。

真正的故障发生在"node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild",这样的好地方,检查将是节点GYP文档:https://github.com/TooTallNate/node-gyp/

我不知道很多关于你的工作平台(好像是一台Mac ),你有make和gcc安装吗? node-gyp github页面提到了这些要求。

我不确定您的使用要求。如果您花费50%的应用程序时间更改文本编码格式,则可能需要iconv。否则,可以试试https://github.com/ashtuchkin/iconv-lite/?由于它是一个纯粹的JS实现,如果你有任何安装问题,我会非常惊讶。 :)

+0

是的,我在OSX 10.7.4和我有安装make和gcc的。我会更仔细地查看node-gyp文档,看看我能看到什么。谢谢。 – James 2012-08-05 13:15:36

+0

我已经添加了一个替代方案。 :) – rdrey 2012-08-05 14:47:36

+0

谢谢你,但我特别想要iconv的原因是我试图按照这个例子https://gist.github.com/1226809。 – James 2012-08-05 22:57:12

1

我在Ubuntu上安装iconv时出错。在我的情况下,我解决了它安装g ++允许编译iconv如此:

sudo apt-get install g++ 

并重新安装iconv。希望它对其他人有帮助!

1

我使用Ubuntu 12.04.3对我的apt-get安装建立必要的解决了这个问题