Node-gyp: Error running `node-gyp configure`

Created on 16 Nov 2019  ·  3Comments  ·  Source: nodejs/node-gyp

  • Node Version: 12.13.0 and 6.12.0 (npm)

  • Platform: OS Name: Microsoft Windows 7 Ultimate
    OS Version: 6.1.7601 Service Pack 1 Build 7601
    System Type: x64-based PC

  • Compiler: C:nativeMessaging>msbuild /version & cl
    'msbuild' is not recognized as an internal or external command,
    operable program or batch file.
    'cl' is not recognized as an internal or external command,
    operable program or batch file. C:\Windows\Microsoft.NET\Framework\v4.0.30319>msbuild Microsoft (R) Build Engine version 4.7.3062.0 [Microsoft .NET Framework, version 4.0.30319.42000] Copyright (C) Microsoft Corporation. All rights reserved. C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.2 3.28105\bin\Hostx64\x64>cl.exe Microsoft (R) C/C++ Optimizing Compiler Version 19.23.28107 for x64 Copyright (C) Microsoft Corporation. All rights reserved.

  • Module: I followed this tutorial:
    https://nodejs.org/docs/latest-v12.x/api/addons.html
    And node-gyp configure isn't working.
    I did npm install -g node-gyp before that.
    Also I created binding.gyp according to that tutorial. I have Visual Studio 2019 with C++ package. Python 3.6.5, but I also tried 3.8 (same result).
    After running node-gyp configure, it only creates the folder build with config.gypi in it.

Verbose output (from npm or node-gyp):

C:\nativeMessaging>node-gyp configure
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info find Python using Python version 3.6.5 found at "C:\python\python.exe"
gyp info find VS using VS2019 (16.3.29509.3) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"

gyp info find VS run with --verbose for detailed information
gyp info spawn C:\python\python.exe
gyp info spawn args [
gyp info spawn args   'C:\\Users\\Имя пользователя\\AppData\\Roaming\\npm\\node_
modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\nativeMessaging\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Имя пользователя\\AppData\\Roaming\\npm\\node_
modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Имя пользователя\\AppData\\Local\\node-gyp\\Ca
che\\12.13.0\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Имя пользователя\\AppData\\Loc
al\\node-gyp\\Cache\\12.13.0',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\Имя пользователя\\AppData\\Roam
ing\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\Имя пользователя\\\\AppDat
a\\\\Local\\\\node-gyp\\\\Cache\\\\12.13.0\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\nativeMessaging',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\nativeMessaging\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
Traceback (most recent call last):
  File "C:\Users\Имя пользователя\AppData\Roaming\npm\node_modules\node-gyp\gyp\
gyp_main.py", line 50, in <module>
    sys.exit(gyp.script_main())
  File "C:\Users\Имя пользователя\AppData\Roaming\npm\node_modules\node-gyp\gyp\
pylib\gyp\__init__.py", line 554, in script_main
    return main(sys.argv[1:])
  File "C:\Users\Имя пользователя\AppData\Roaming\npm\node_modules\node-gyp\gyp\
pylib\gyp\__init__.py", line 547, in main
    return gyp_main(args)
  File "C:\Users\Имя пользователя\AppData\Roaming\npm\node_modules\node-gyp\gyp\
pylib\gyp\__init__.py", line 523, in gyp_main
    options.duplicate_basename_check)
  File "C:\Users\Имя пользователя\AppData\Roaming\npm\node_modules\node-gyp\gyp\
pylib\gyp\__init__.py", line 139, in Load
    params['parallel'], params['root_targets'])
  File "C:\Users\Имя пользователя\AppData\Roaming\npm\node_modules\node-gyp\gyp\
pylib\gyp\input.py", line 2783, in Load
    variables, includes, depth, check, True)
  File "C:\Users\Имя пользователя\AppData\Roaming\npm\node_modules\node-gyp\gyp\
pylib\gyp\input.py", line 392, in LoadTargetBuildFile
    includes, True, check)
  File "C:\Users\Имя пользователя\AppData\Roaming\npm\node_modules\node-gyp\gyp\
pylib\gyp\input.py", line 264, in LoadOneBuildFile
    aux_data, includes, check)
  File "C:\Users\Имя пользователя\AppData\Roaming\npm\node_modules\node-gyp\gyp\
pylib\gyp\input.py", line 301, in LoadBuildFileIncludesIntoDict
    LoadOneBuildFile(include, data, aux_data, None, False, check),
  File "C:\Users\Имя пользователя\AppData\Roaming\npm\node_modules\node-gyp\gyp\
pylib\gyp\input.py", line 234, in LoadOneBuildFile
    build_file_contents = open(build_file_path, 'rU').read()
  File "C:\python\lib\encodings\cp1251.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 2399: cha
racter maps to <undefined>
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Users\Имя пользователя\AppData\R
oaming\npm\node_modules\node-gyp\lib\configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_proces
s.js:272:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Имя пользоват
еля\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure
"
gyp ERR! cwd C:\nativeMessaging
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v6.0.1
gyp ERR! not ok

C:\nativeMessaging>

Most helpful comment

The issue was with Russian (Cyrillic) folder names, I had to rename this folder: C:Users\[username] (it's important to google how to change it correctly).

All 3 comments

Win7?!? Can you please try with Python 2 instead of 3?

Getting a different error on Python 2:

Verbose output (from npm or node-gyp):

C:\nativeMessaging>node-gyp configure
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info find Python using Python version 2.7.17 found at "C:\Python27\python.ex
e"
gyp info find VS using VS2019 (16.3.29509.3) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"

gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Python27\python.exe
gyp info spawn args [
gyp info spawn args   'C:\\Users\\Имя пользователя\\AppData\\Roaming\\npm\\node_
modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\nativeMessaging\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Имя пользователя\\AppData\\Roaming\\npm\\node_
modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Имя пользователя\\AppData\\Local\\node-gyp\\Ca
che\\12.13.0\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Имя пользователя\\AppData\\Loc
al\\node-gyp\\Cache\\12.13.0',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\Имя пользователя\\AppData\\Roam
ing\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\Имя пользователя\\\\AppDat
a\\\\Local\\\\node-gyp\\\\Cache\\\\12.13.0\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\nativeMessaging',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\nativeMessaging\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
Traceback (most recent call last):
  File "C:\Users\╚ь  яюы№чютрЄхы \AppData\Roaming\npm\node_modules\node-gyp\gyp\
gyp_main.py", line 50, in <module>
    sys.exit(gyp.script_main())
  File "C:\Users\╚ь  яюы№чютрЄхы \AppData\Roaming\npm\node_modules\node-gyp\gyp\
pylib\gyp\__init__.py", line 554, in script_main
    return main(sys.argv[1:])
  File "C:\Users\╚ь  яюы№чютрЄхы \AppData\Roaming\npm\node_modules\node-gyp\gyp\
pylib\gyp\__init__.py", line 547, in main
    return gyp_main(args)
  File "C:\Users\╚ь  яюы№чютрЄхы \AppData\Roaming\npm\node_modules\node-gyp\gyp\
pylib\gyp\__init__.py", line 532, in gyp_main
    generator.GenerateOutput(flat_list, targets, data, params)
  File "C:\Users\╚ь  яюы№чютрЄхы \AppData\Roaming\npm\node_modules\node-gyp\gyp\
pylib\gyp\generator\msvs.py", line 2023, in GenerateOutput
    generator_flags))
  File "C:\Users\╚ь  яюы№чютрЄхы \AppData\Roaming\npm\node_modules\node-gyp\gyp\
pylib\gyp\generator\msvs.py", line 958, in _GenerateProject
    return _GenerateMSBuildProject(project, options, version, generator_flags)
  File "C:\Users\╚ь  яюы№чютрЄхы \AppData\Roaming\npm\node_modules\node-gyp\gyp\
pylib\gyp\generator\msvs.py", line 3335, in _GenerateMSBuildProject
    extension_to_rule_name, _GetUniquePlatforms(spec))
  File "C:\Users\╚ь  яюы№чютрЄхы \AppData\Roaming\npm\node_modules\node-gyp\gyp\
pylib\gyp\generator\msvs.py", line 2073, in _GenerateMSBuildFiltersFile
    filter_group, source_group)
  File "C:\Users\╚ь  яюы№чютрЄхы \AppData\Roaming\npm\node_modules\node-gyp\gyp\
pylib\gyp\generator\msvs.py", line 2115, in _AppendFiltersForMSBuild
    platforms, filter_group, source_group)
  File "C:\Users\╚ь  яюы№чютрЄхы \AppData\Roaming\npm\node_modules\node-gyp\gyp\
pylib\gyp\generator\msvs.py", line 2115, in _AppendFiltersForMSBuild
    platforms, filter_group, source_group)
  File "C:\Users\╚ь  яюы№чютрЄхы \AppData\Roaming\npm\node_modules\node-gyp\gyp\
pylib\gyp\generator\msvs.py", line 2111, in _AppendFiltersForMSBuild
    ['UniqueIdentifier', MSVSNew.MakeGuid(source.name)]])
  File "C:\Users\╚ь  яюы№чютрЄхы \AppData\Roaming\npm\node_modules\node-gyp\gyp\
pylib\gyp\MSVSNew.py", line 48, in MakeGuid
    d = hashlib.md5((str(seed) + str(name)).encode('utf-8')).hexdigest().upper()

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc8 in position 8: ordinal
not in range(128)
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Users\Имя пользователя\AppData\R
oaming\npm\node_modules\node-gyp\lib\configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_proces
s.js:272:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Имя пользоват
еля\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure
"
gyp ERR! cwd C:\nativeMessaging
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v6.0.1
gyp ERR! not ok

The issue was with Russian (Cyrillic) folder names, I had to rename this folder: C:Users\[username] (it's important to google how to change it correctly).

Was this page helpful?
0 / 5 - 0 ratings