0

I am using Centos 6.6 installed on the server and trying to use node-gyp but I get a error when I am using the command node-gyp configure, the python version I am using is 2.7.8 and GCC C++ compiler. The Error I get is mentioned below.

gyp info it worked if it ends with ok

gyp info using node-gyp@1.0.2

gyp info using node@0.10.35 | 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   '/root/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.35/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.35',

gyp info spawn args   '-Dmodule_root_dir=/root',

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 
    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:343:16)

gyp ERR! stack     at ChildProcess.emit (events.js:98:17)

gyp ERR! stack     at Process.ChildProcess._handle.onexit 

(child_process.js:820:12)

gyp ERR! System Linux 2.6.32-504.3.3.el6.x86_64

gyp ERR! command "node" "/usr/local/bin/node-gyp" "configure"

gyp ERR! cwd /root

gyp ERR! node -v v0.10.35

gyp ERR! node-gyp -v v1.0.2

gyp ERR! not ok
mscdex
  • 104,356
  • 15
  • 192
  • 153
Sunil
  • 11
  • 1
  • 5
  • As the error says, you have a syntax error in your `binding.gyp`. Can you post that file? – mscdex Feb 08 '15 at 13:55
  • I have used the syntax as shown in the link https://github.com/TooTallNate/node-gyp – Sunil Feb 08 '15 at 15:07
  • Well, without seeing the exact `binding.gyp` you are using, it's hard to tell exactly what the syntax problem is. – mscdex Feb 08 '15 at 17:34
  • The code I have used for binding.gyp is { "targets": [ { "target_name": "binding", "sources": [ "src/binding.cc" ] } ] } – Sunil Feb 09 '15 at 04:35
  • Did you happen to edit this file on Windows? This could be a problem with `\r` carriage return characters inside the file. You could remove any `\r` characters using sed or something like `dos2unix` (available via yum) just to be sure. – mscdex Feb 09 '15 at 05:21
  • I have used the code $ cat bynding.gyp | sed 's/\r$//' | od -c and – Sunil Feb 09 '15 at 10:06
  • and then when I run node-gyp configure I still get the same error cat binding.gyp | sed 's/\r$//' | od -c 0000000 { \n " t a r g e t s " : [ 0000020 \n { \n " t a 0000040 r g e t _ n a m e " : " b i n 0000060 d i n g " , \n " s o 0000100 u r c e s " : [ " s r c / b 0000120 i n d i n g . c c " ] \n 0000140 } \n ] \n } 0000150 – Sunil Feb 09 '15 at 10:09
  • 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:343:16) gyp ERR! stack at ChildProcess.emit (events.js:98:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:820:12) gyp ERR! System Linux 2.6.32-504.3.3.el6.x86_64 gyp ERR! command "node" "/usr/local/bin/node-gyp" "configure" gyp ERR! cwd /root gyp ERR! node -v v0.10.35 gyp ERR! node-gyp -v v1.0.2 gyp ERR! not ok – Sunil Feb 09 '15 at 10:10
  • Ok, you piped binding.gyp to sed, but did you actually write the output of sed back to binding.gyp? – mscdex Feb 09 '15 at 14:27

0 Answers0