question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Better output for bad target_name (was: Incorrect Error logs on v5.0.0)

See original GitHub issue
  • Node Version: 10.16.0
  • Platform: Windows10
  • Compiler: VS2019
  • Module: rebuild

example: https://github.com/Himself65/kcp-node/tree/bug, you can reproduce it with run yarn install or npm install


when building.gyp contains target_name char -, it shows the incorrect error logs.

{
  'targets': [
    {
      'target_name': 'kcp-',
      'sources': [ './lib/kcp-node.cc' ]
    }
  ]
}

and I think it should log like incorrect target_name format but it’s C++ grammar error, and coding is absolutely right

Verbose output (from npm or node-gyp):
C:\Users\himself65\Desktop\Github\kcp-node>yarn
yarn install v1.16.0
[1/4] Resolving packages...
success Already up-to-date.
$ node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@5.0.0
gyp info using node@10.16.0 | win32 | x64
gyp info find Python using Python version 2.7.16 found at "C:\Python27\python.exe"
gyp info find VS using VS2019 (16.1.29009.5) 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 [ 'C:\\Users\\himself65\\Desktop\\Github\\kcp-node\\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:\\Users\\himself65\\Desktop\\Github\\kcp-node\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\himself65\\Desktop\\Github\\kcp-node\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\himself65\\AppData\\Local\\node-gyp\\Cache\\10.16.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\\himself65\\AppData\\Local\\node-gyp\\Cache\\10.16.0',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\himself65\\Desktop\\Github\\kcp-node\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\Users\\himself65\\AppData\\Local\\node-gyp\\Cache\\10.16.0\\<(target_arch)\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\himself65\\Desktop\\Github\\kcp-node',
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:\\Users\\himself65\\Desktop\\Github\\kcp-node\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
在此解决方案中一次生成一个项目。若要启用并行生成,请添加“-m”开关。
  kcp-node.cc
  win_delay_load_hook.cc
C:\Users\himself65\Desktop\Github\kcp-node\lib\kcp-node.cc(34,1): error C2143:  语法错误: 缺少“;”(在“-”的前面) [C:\Users\himself65\Desktop\Gi
thub\kcp-node
\build\kcp-.vcxproj]
C:\Users\himself65\Desktop\Github\kcp-node\lib\kcp-node.cc(34,1): warning C4229:  使用了记时错误: 忽略数据上的修饰符 [C:\Users\himself65\Desktop\
Github\kcp-node
\build\kcp-.vcxproj]
C:\Users\himself65\Desktop\Github\kcp-node\lib\kcp-node.cc(34,1): error C2182:  “_register_kcp”: 非法使用“void”类型 [C:\Users\himself65\Deskt
op\Github
\kcp-node\build\kcp-.vcxproj]
C:\Users\himself65\Desktop\Github\kcp-node\lib\kcp-node.cc(34,1): error C2143:  语法错误: 缺少“)”(在“-”的前面) [C:\Users\himself65\Desktop\Gi
thub\kcp-node
\build\kcp-.vcxproj]
C:\Users\himself65\Desktop\Github\kcp-node\lib\kcp-node.cc(34,1): error C2165:  “左侧修饰符”: 不能修改指向数据的指针 [C:\Users\himself65\Deskto
p\Github\kcp-node
\build\kcp-.vcxproj]
C:\Users\himself65\Desktop\Github\kcp-node\lib\kcp-node.cc(34,1): error C2059:  语法错误:“)” [C:\Users\himself65\Desktop\Github\kcp-node\build\
kcp-.
vcxproj]
C:\Users\himself65\Desktop\Github\kcp-node\lib\kcp-node.cc(34,1): error C2086:  “int _register_kcp”: 重定义 [C:\Users\himself65\Desktop\Github\
kcp-
node\build\kcp-.vcxproj]
C:\Users\himself65\Desktop\Github\kcp-node\lib\kcp-node.cc(34): message :  参见“_register_kcp”的声明 [C:\Users\himself65\Desktop\Github\kcp-nod
e\buil
d\kcp-.vcxproj]
C:\Users\himself65\Desktop\Github\kcp-node\lib\kcp-node.cc(34,1): error C2143:  语法错误: 缺少“;”(在“{”的前面) [C:\Users\himself65\Desktop\Gi
thub\kcp-node
\build\kcp-.vcxproj]
C:\Users\himself65\Desktop\Github\kcp-node\lib\kcp-node.cc(34,1): error C2447:  “{”: 缺少函数标题(是否是老式的形式表?) [C:\Users\himself65\Desk
top\Github\kcp-n
ode\build\kcp-.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\himself65\Desktop\Github\kcp-node\node_modules\node-gyp\lib\build.js:190:23)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\himself65\\Desktop\\Github\\kcp-node\\node_modules\\node-gyp\\bin\\node-gyp.js
" "rebuild"
gyp ERR! cwd C:\Users\himself65\Desktop\Github\kcp-node
gyp ERR! node -v v10.16.0
gyp ERR! node-gyp -v v5.0.0
gyp ERR! not ok
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

but when I run it without char - in target_name, it runs successfully.

{
  'targets': [
    {
      'target_name': 'kcp',
      'sources': [ './lib/kcp-node.cc' ]
    }
  ]
}
Verbose output (from npm or node-gyp):
C:\Users\himself65\Desktop\Github\kcp-node>yarn
yarn install v1.16.0
[1/4] Resolving packages...
success Already up-to-date.
$ node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@5.0.0
gyp info using node@10.16.0 | win32 | x64
gyp info find Python using Python version 2.7.16 found at "C:\Python27\python.exe"
gyp info find VS using VS2019 (16.1.29009.5) 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 [ 'C:\\Users\\himself65\\Desktop\\Github\\kcp-node\\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:\\Users\\himself65\\Desktop\\Github\\kcp-node\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\himself65\\Desktop\\Github\\kcp-node\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\himself65\\AppData\\Local\\node-gyp\\Cache\\10.16.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\\himself65\\AppData\\Local\\node-gyp\\Cache\\10.16.0',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\himself65\\Desktop\\Github\\kcp-node\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\Users\\himself65\\AppData\\Local\\node-gyp\\Cache\\10.16.0\\<(target_arch)\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\himself65\\Desktop\\Github\\kcp-node',
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:\\Users\\himself65\\Desktop\\Github\\kcp-node\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
在此解决方案中一次生成一个项目。若要启用并行生成,请添加“-m”开关。
  kcp-node.cc
  win_delay_load_hook.cc
    正在创建库 C:\Users\himself65\Desktop\Github\kcp-node\build\Release\kcp.lib 和对象 C:\Users\himself65\Desktop\Github\kcp-node\build\Release\k
cp.exp
  正在生成代码
  Previous IPDB not found, fall back to full compilation.
  All 26 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
  已完成代码的生成
  kcp.vcxproj -> C:\Users\himself65\Desktop\Github\kcp-node\build\Release\\kcp.node
gyp info ok
Done in 4.22s.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
rvaggcommented, Jun 20, 2019

ok I’ve renamed this because that’s not a bad suggestion, I just don’t know if it belongs here or in https://github.com/refack/GYP

0reactions
Himself65commented, Jun 20, 2019

@rvagg yes, that’s what I meant.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot login to concourse via fly with username & ...
Bug Report I'm getting a 401 error when attempting to do a fly login when providing credentials. I am currently using fly version...
Read more >
Error DependsOnTargets. _collectBundleResourses
However, if the properties are not set, we pick some defaults. OutDir: Indicates the final output location for the project or solution. When...
Read more >
FortiManager v5.0 Patch Release 1 Log Message Reference
FortiManager v5.0.1 Log Message Reference. 127. Severity. Warning. Message msg= “FTP error: Wrong password”. Description. FTP error, wrong ...
Read more >
The command "npm run build -- --prod" exited with code 1 ...
From the error in your output window, it seems that the npm build command is targeting the wrong directory and cannot find the...
Read more >
v5 Release Notes | Documentation
NET Core is the trail of outdated blog posts and invalid documentation which has resulted in a lot of confusion and poor messaging...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found