在OS X上安装pty.js(节点)的错误

时间:2014-07-25 07:05:24

标签: node.js npm pty

尝试使用node:

安装pty.js时遇到了一个不寻常的问题

如果我运行npm install pty.js,我收到此错误:

> node-gyp rebuild

  CXX(target) Release/obj.target/pty/src/unix/pty.o
../src/unix/pty.cc:487:10: error: use of undeclared identifier 'openpty'
  return openpty(amaster, aslave, name, (termios *)termp, (winsize *)winp);
         ^
../src/unix/pty.cc:533:10: error: use of undeclared identifier 'forkpty'
  return forkpty(amaster, name, (termios *)termp, (winsize *)winp);
         ^
2 errors generated.
make: *** [Release/obj.target/pty/src/unix/pty.o] 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:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:809:12)
gyp ERR! System Darwin 13.3.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/otiswright/Developer/Projects/Web/Hatchway/node_modules/pty.js
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.13.1
gyp ERR! not ok 
npm ERR! pty.js@0.2.4 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the pty.js@0.2.4 install script.
npm ERR! This is most likely a problem with the pty.js 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 pty.js
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 13.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "pty.js"
npm ERR! cwd /Users/otiswright/Developer/Projects/Web/Hatchway
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.5.0-alpha-4
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/otiswright/Developer/Projects/Web/Hatchway/npm-debug.log
npm ERR! not ok code 0

我安装了node-gyp,运行OS X并安装了xcode +命令行。

我不确定问题出在哪里?可能是依赖。

1 个答案:

答案 0 :(得分:24)

我对不同的节点包devtools-terminal有同样的问题。

问题是OSX的{​​{1}}错误地配置了头文件。{/ 3}。

这是我使用的工作:

  1. mkdir /tmp/pty.js
  2. git clone https://github.com/chjj/pty.js.git /tmp/pty.js
  3. vi /tmp/pty.js/src/unix/pty.cc
  4. 使用#include <util.h>
  5. 替换第39行:#include "/usr/include/util.h"
  6. npm install -g /tmp/pty.js
  7. 现在npm install -g devtools-terminal应该可以使用。
  8. 这样您就可以在pty.js中解决问题,并使用本地副本作为要安装的软件包的依赖项。

    祝你好运!