编译简单程序时node-gyp出错

时间:2013-10-21 19:14:53

标签: node.js node-gyp

我正在从Addons Node.js v0.10.21 doc编译我的第一个hello world node-gyp程序。 键入" node-gyp configure"导致错误,如下所示。感谢修复此错误的任何帮助。

node-gyp configure
gyp info it worked if it ends with ok
gyp info using node-gyp@0.10.10
.......
.......
Traceback (most recent call last):
  File "/usr/local/lib/node_modules/node-gyp/gyp/gyp", line 18, in <module>
    sys.exit(gyp.main(sys.argv[1:]))
  File "/usr/local/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 526, in main
    return gyp_main(args)
  File "/usr/local/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 502, in gyp_main
    options.circular_check)
  File "/usr/local/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 131, in Load
    params['parallel'])
  File "/usr/local/lib/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 2574, in Load
    targets = BuildTargetsDict(data)
  File "/usr/local/lib/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 1273, in BuildTargetsDict
    target['target_name'],
KeyError: 'target_name'
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/node-gyp/lib/configure.js:424:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.8.0-31-generic
gyp ERR! command "node" "/usr/local/bin/node-gyp" "configure"
gyp ERR! cwd /home/jq/test/node/hw-gyp
gyp ERR! node -v v0.10.20
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok 

1 个答案:

答案 0 :(得分:0)

KeyError:'target_name'

听起来您无法在binding.gyp文件中指定target_name属性。你可以在你的问题中发布binding.gyp的内容吗?