英文:
node-gyp: "..\src\binding.cc: no such file or directory"
问题
我在使用electron-builder构建Electron应用程序时遇到了“..\src\binding.cc: 文件或目录不存在”的问题。日志如下:
⨯ node-gyp.cmd 退出并显示 ERR_ELECTRON_BUILDER_CANNOT_EXECUTE 错误代码
输出:
警告:缺少输入文件:
C:\Users\%user%\source\repos\electronvueapp\build\..\src\binding.cc
�믮������ ������⥫쭠� ᡮઠ ��⮢ � �⮬ �襭��。�⮡� ������� ��ࠫ������ ᡮ��,������� ��ࠬ��� "-m"。
binding.cc
c1xx:致命错误 C1083:�� 㤠���� ������ 䠩� ���筨�:..\src\binding.cc:找不到文件或目录,[C:\Users\%user%\source\repos\electronvueapp\build\binding.vcxproj]
通过Google搜索,我主要得到了类似于以下链接引用的结果:https://stackoverflow.com/questions/44357010/node-gyp-build-fatal-error-c1083
常见的解决方案是在该路径下创建一个空的“binding.cc”文件,但我的问题是,每次我尝试构建应用程序时,它都会删除“build”文件夹并创建一个新的文件夹,但其中没有“binding.cc”文件。
英文:
I have stumbled upon "..\src\binding.cc: no such file or directory" when building an Electron app with electron-builder. Log:
⨯ node-gyp.cmd exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Output:
Warning: Missing input files:
C:\Users\%user%\source\repos\electronvueapp\build\..\src\binding.cc
�믮������ ������⥫쭠� ᡮઠ ��⮢ � �⮬ �襭��. �⮡� ������� ��ࠫ������ ᡮ��, ������� ��ࠬ��� "-m".
binding.cc
c1xx : fatal error C1083: �� 㤠���� ������ 䠩� ���筨�: ..\src\binding.cc: No such file or directory, [C:\Users\%user%\source\repos\electronvueapp\build\binding.vcxproj]
Googling mostly gave me results alike referenced here: https://stackoverflow.com/questions/44357010/node-gyp-build-fatal-error-c1083
The common solution is to just create an empty "binding.cc" at the path, but my problem is that every time I try to build the app it just removes the "build" folder and makes a new one, but without the "binding.cc" in it
答案1
得分: 1
构建和 bin 文件夹将在每次安装时删除。您可以更改构建文件夹的名称为其他任何名称。
示例目录:
-dir_of_cc
-binding.cc
-binding.gyp
binding.gyp 文件中的 Binding 属性对象:
{
"target_name": "binding-name",
"cflags!": [ "-fno-exceptions" ],
"cflags_cc!": [ "-fno-exceptions" ],
"sources": ["dir_of_cc/binding.cc"],
'include_dirs': [
"<!@(node -p \"require('node-addon-api').include\")"
],
'libraries': [],
'dependencies': [
"<!@(node -p \"require('node-addon-api').gyp\")"
],
'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ]
}
英文:
Build and bin folders will be delete every install. You can change the build folder name anything else.
Sample directory:
-dir_of_cc
-binding.cc
-binding.gyp
Binding attribute object in binding.gyp file:
{
"target_name": "binding-name",
"cflags!": [ "-fno-exceptions" ],
"cflags_cc!": [ "-fno-exceptions" ],
"sources": ["dir_of_cc\binding.cc"],
'include_dirs': [
"<!@(node -p \"require('node-addon-api').include\")"
],
'libraries': [],
'dependencies': [
"<!(node -p \"require('node-addon-api').gyp\")"
],
'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ]
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论