在 Linux 环境 运行 node-gyp configure 出错了,在线求助
发布于 10 年前 作者 tshanchuan 12759 次浏览 最后一次编辑是 8 年前

在 Linux 环境运行 node-gyp configure 出错了,在线求助

gyp info it worked if it ends with ok
gyp info using node-gyp[@0](/user/0).13.0
gyp info using node[@0](/user/0).10.4 | linux | x64
gyp info spawn python
gyp info spawn args [ '/usr/local/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/workspace/wwwroot/n_phpip/tsc/tj/node_modules/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.node-gyp/0.10.4/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/root/.node-gyp/0.10.4',
gyp info spawn args   '-Dmodule_root_dir=/workspace/wwwroot/n_phpip/tsc/tj/node_modules',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
Traceback (most recent call last):
  File "/usr/local/lib/node_modules/node-gyp/gyp/gyp_main.py", line 18, in <module>
    sys.exit(gyp.script_main())
  File "/usr/local/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 534, in script_main
    return main(sys.argv[1:])
  File "/usr/local/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 527, in main
    return gyp_main(args)
  File "/usr/local/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 503, in gyp_main
    options.circular_check)
  File "/usr/local/lib/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 129, in Load
    params['parallel'], params['root_targets'])
  File "/usr/local/lib/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 2692, in Load
    variables, includes, depth, check, True)
  File "/usr/local/lib/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 362, in LoadTargetBuildFile
    includes, True, check)
  File "/usr/local/lib/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 219, in LoadOneBuildFile
    None)
  File "binding.gyp", line 1
    {
     ^
SyntaxError: invalid syntax
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:340:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:784:12)
gyp ERR! System Linux 2.6.32-220.el6.x86_64
gyp ERR! command "node" "/usr/local/bin/node-gyp" "configure"
gyp ERR! cwd /workspace/wwwroot/n_phpip/tsc/tj/node_modules
gyp ERR! node -v v0.10.4
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok 
9 回复

楼主的格式… 帮改了, 不清楚, 但是报语法错误的话, 楼主总要说明是在什么项目里跑的命令? 另外 C++ 代码是自己写的不?

公司有人提供C的代码,用来做我nodejs的扩展模块…

没有binding.gyp文件

有这个文件,和build 是同一目录的

@tshanchuan 表示不会写 C++, 但是两个地方报错具体的内容不一样的吧…

@jiyinyiyong 我错了,linux本身有python环境…

是binding.gyp文件报错了,已解决。

我也遇到类似的问题 gyp: binding.gyp not found (cwd: /home/ec2-user/login) while trying to load binding.gyp gyp ERR! configure error gyp ERR! stack Error: gyp failed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (/nodejs/lib/node_modules/node-gyp/lib/configure.js:357:16) gyp ERR! stack at ChildProcess.emit (events.js:110:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12) gyp ERR! System Linux 3.14.35-28.38.amzn1.x86_64 gyp ERR! command “node” “/nodejs/bin/node-gyp” "configure" gyp ERR! cwd /home/ec2-user/login gyp ERR! node -v v0.12.7 gyp ERR! node-gyp -v v2.0.2 gyp ERR! not ok

请问 binding.gyp 这个文件是自动生成的还是必须自己去创建的!?在git的那个项目哪里没有介绍需要自己去建这个文件吧!?

回到顶部