yanyiwu / nodejieba

"结巴"中文分词的Node.js版本
MIT License
3.05k stars 277 forks source link

cannot build in electron 20, node 16 #228

Closed dannyZhou closed 4 weeks ago

dannyZhou commented 1 year ago

  • electron-builder  version=22.14.13
  • rebuilding native dependencies  dependencies=nodejieba@2.5.2 platform=win32 arch=x64
  ⨯ cannot execute  cause=exit status 1
                    errorOut=npm ERR! code 1
    npm ERR! path D:\proj\abc-electron\node_modules\nodejieba
    npm ERR! command failed
    npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build
    npm ERR! 在此解决方案中一次生成一个项目。若要启用并行生成,请添加“-m”开关。
    npm ERR!   index.cpp
    npm ERR!   nodejieba.cpp
    npm ERR! D:\proj\abc-electron\node_modules\nodejieba\deps\limonp\StringUtil.hpp(87,70): error C2039: "ptr_fun": 不是 "std" 的成员 [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! D:\proj\abc-electron\node_modules\nodejieba\deps\limonp\StdExtension.hpp(32): message : 参见“std”的声明 [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! D:\proj\abc-electron\node_modules\nodejieba\deps\limonp\StringUtil.hpp(87,77): error C2065: “ptr_fun”: 未声明的标识符 [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! D:\proj\abc-electron\node_modules\nodejieba\deps\limonp\StringUtil.hpp(87,78): error C2062: 意外的类型“unsigned int” [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! D:\proj\abc-electron\node_modules\nodejieba\deps\limonp\StringUtil.hpp(92,61): error C2039: "ptr_fun": 不是 "std" 的成员 [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! D:\proj\abc-electron\node_modules\nodejieba\deps\limonp\StdExtension.hpp(32): message : 参见“std”的声明 [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! D:\proj\abc-electron\node_modules\nodejieba\deps\limonp\StringUtil.hpp(92,68): error C2065: “ptr_fun”: 未声明的标识符 [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! D:\proj\abc-electron\node_modules\nodejieba\deps\limonp\StringUtil.hpp(92,69): error C2062: 意外的类型“unsigned int” [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! D:\proj\abc-electron\node_modules\nodejieba\deps\limonp\StringUtil.hpp(101,70): error C2039: "bind2nd": 不是 "std" 的成员 [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! D:\proj\abc-electron\node_modules\nodejieba\deps\limonp\StdExtension.hpp(32): message : 参见“std”的声明 [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! D:\proj\abc-electron\node_modules\nodejieba\deps\limonp\StringUtil.hpp(101,77): error C3861: “bind2nd”: 找不到标识符 [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! D:\proj\abc-electron\node_modules\nodejieba\deps\limonp\StringUtil.hpp(101,27): error C2672: “std::find_if”: 未找到匹配的重载函数 [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! D:\proj\abc-electron\node_modules\nodejieba\deps\limonp\StringUtil.hpp(101,104): error C2780: “_FwdIt std::find_if(_ExPo &&,_FwdIt,const _FwdIt,_Pr) noexcept”: 应输入 4 个参数,却提供了 2 个 [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\algorithm(348): message : 参见“std::find_if”的声明 [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! D:\proj\abc-electron\node_modules\nodejieba\deps\limonp\StringUtil.hpp(101,104): error C2780: “_InIt std::find_if(_InIt,const _InIt,_Pr)”: 应输入 3 个参数,却提供了 2 个 [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xutility(5527): message : 参见“std::find_if”的声明 [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! D:\proj\abc-electron\node_modules\nodejieba\deps\limonp\StringUtil.hpp(106,61): error C2039: "bind2nd": 不是 "std" 的成员 [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! D:\proj\abc-electron\node_modules\nodejieba\deps\limonp\StdExtension.hpp(32): message : 参见“std”的声明 [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! D:\proj\abc-electron\node_modules\nodejieba\deps\limonp\StringUtil.hpp(106,68): error C3861: “bind2nd”: 找不到标识符 [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! D:\proj\abc-electron\node_modules\nodejieba\deps\limonp\StringUtil.hpp(106,16): error C2672: “std::find_if”: 未找到匹配的重载函数 [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! D:\proj\abc-electron\node_modules\nodejieba\deps\limonp\StringUtil.hpp(106,95): error C2780: “_FwdIt std::find_if(_ExPo &&,_FwdIt,const _FwdIt,_Pr) noexcept”: 应输入 4 个参数,却提供了 2 个 [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\algorithm(348): message : 参见“std::find_if”的声明 [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! D:\proj\abc-electron\node_modules\nodejieba\deps\limonp\StringUtil.hpp(106,95): error C2780: “_InIt std::find_if(_InIt,const _InIt,_Pr)”: 应输入 3 个参数,却提供了 2 个 [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\xutility(5527): message : 参见“std::find_if”的声明 [D:\proj\abc-electron\node_modules\nodejieba\build\nodejieba.vcxproj]
    npm ERR! Failed to execute 'C:\sf\nodejs\node.exe C:\sf\nvm\v16.20.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=D:\proj\abc-electron\node_modules\nodejieba\build\Release\nodejieba.node --module_name=nodejieba --module_path=D:\proj\abc-electron\node_modules\nodejieba\build\Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=electron-v20.3' (1)
    npm ERR! node-pre-gyp info it worked if it ends with ok
    npm ERR! node-pre-gyp info using node-pre-gyp@1.0.11
    npm ERR! node-pre-gyp info using node@16.20.0 | win32 | x64
    npm ERR! node-pre-gyp http GET https://github.com/yanyiwu/nodejieba/releases/download/v2.5.2/nodejieba-v2.5.2-electron-v20.3-win32-x64.tar.gz
    npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/yanyiwu/nodejieba/releases/download/v2.5.2/nodejieba-v2.5.2-electron-v20.3-win32-x64.tar.gz
    npm ERR! node-pre-gyp WARN Pre-built binaries not installable for nodejieba@2.5.2 and electron@20.3.12 (electron-v20.3 ABI, unknown) (falling back to source compile with node-gyp)
    npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/yanyiwu/nodejieba/releases/download/v2.5.2/nodejieba-v2.5.2-electron-v20.3-win32-x64.tar.gz
    npm ERR! gyp info it worked if it ends with ok
    npm ERR! gyp info using node-gyp@9.1.0
    npm ERR! gyp info using node@16.20.0 | win32 | x64
    npm ERR! gyp info ok
    npm ERR! gyp info it worked if it ends with ok
    npm ERR! gyp info using node-gyp@9.1.0
    npm ERR! gyp info using node@16.20.0 | win32 | x64
    npm ERR! gyp info find Python using Python version 3.10.9 found at "E:\sf\anaconda3\python.exe"
    npm ERR! gyp info find VS using VS2019 (16.11.33529.622) found at:
    npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
    npm ERR! gyp info find VS run with --verbose for detailed information
    npm ERR! gyp info spawn E:\sf\anaconda3\python.exe
    npm ERR! gyp info spawn args [
    npm ERR! gyp info spawn args   'C:\\sf\\nvm\\v16.20.0\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
    npm ERR! gyp info spawn args   'binding.gyp',
    npm ERR! gyp info spawn args   '-f',
    npm ERR! gyp info spawn args   'msvs',
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   'D:\\proj\\abc-electron\\node_modules\\nodejieba\\build\\config.gypi',
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   'C:\\sf\\nvm\\v16.20.0\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   'C:\\Users\\danny\\.electron-gyp\\20.3.12\\include\\node\\common.gypi',
    npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
    npm ERR! gyp info spawn args   '-Dvisibility=default',
    npm ERR! gyp info spawn args   '-Dnode_root_dir=C:\\Users\\danny\\.electron-gyp\\20.3.12',
    npm ERR! gyp info spawn args   '-Dnode_gyp_dir=C:\\sf\\nvm\\v16.20.0\\node_modules\\npm\\node_modules\\node-gyp',
    npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\danny\\\\.electron-gyp\\\\20.3.12\\\\<(target_arch)\\\\node.lib',
    npm ERR! gyp info spawn args   '-Dmodule_root_dir=D:\\proj\\abc-electron\\node_modules\\nodejieba',
    npm ERR! gyp info spawn args   '-Dnode_engine=v8',
    npm ERR! gyp info spawn args   '--depth=.',
    npm ERR! gyp info spawn args   '--no-parallel',
    npm ERR! gyp info spawn args   '--generator-output',
    npm ERR! gyp info spawn args   'D:\\proj\\abc-electron\\node_modules\\nodejieba\\build',
    npm ERR! gyp info spawn args   '-Goutput_dir=.'
    npm ERR! gyp info spawn args ]
    npm ERR! gyp info ok
    npm ERR! gyp info it worked if it ends with ok
    npm ERR! gyp info using node-gyp@9.1.0
    npm ERR! gyp info using node@16.20.0 | win32 | x64
    npm ERR! gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
    npm ERR! gyp info spawn args [
    npm ERR! gyp info spawn args   'build/binding.sln',
    npm ERR! gyp info spawn args   '/clp:Verbosity=minimal',
    npm ERR! gyp info spawn args   '/nologo',
    npm ERR! gyp info spawn args   '/p:Configuration=Release;Platform=x64'
    npm ERR! gyp info spawn args ]
    npm ERR! gyp ERR! build error
    npm ERR! gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
    npm ERR! gyp ERR! stack     at ChildProcess.onExit (C:\sf\nvm\v16.20.0\node_modules\npm\node_modules\node-gyp\lib\build.js:201:23)
    npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
    npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
    npm ERR! gyp ERR! System Windows_NT 10.0.22621
    npm ERR! gyp ERR! command "C:\\sf\\nodejs\\node.exe" "C:\\sf\\nvm\\v16.20.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=D:\\proj\\abc-electron\\node_modules\\nodejieb
a\\build\\Release\\nodejieba.node" "--module_name=nodejieba" "--module_path=D:\\proj\\abc-electron\\node_modules\\nodejieba\\build\\Release" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=electron-v20.3"
    npm ERR! gyp ERR! cwd D:\proj\abc-electron\node_modules\nodejieba
    npm ERR! gyp ERR! node -v v16.20.0
    npm ERR! gyp ERR! node-gyp -v v9.1.0
    npm ERR! gyp ERR! not ok
    npm ERR! node-pre-gyp ERR! build error
    npm ERR! node-pre-gyp ERR! stack Error: Failed to execute 'C:\sf\nodejs\node.exe C:\sf\nvm\v16.20.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=D:\proj\abc-electron\node_modules\
nodejieba\build\Release\nodejieba.node --module_name=nodejieba --module_path=D:\proj\abc-electron\node_modules\nodejieba\build\Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=electron-v20.3' (1)
    npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (D:\proj\abc-electron\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23)
    npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
    npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1100:16)
    npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
    npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.22621
    npm ERR! node-pre-gyp ERR! command "C:\\sf\\nodejs\\node.exe" "D:\\proj\\abc-electron\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
    npm ERR! node-pre-gyp ERR! cwd D:\proj\abc-electron\node_modules\nodejieba
    npm ERR! node-pre-gyp ERR! node -v v16.20.0
    npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.11
    npm ERR! node-pre-gyp ERR! not ok

    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\danny\AppData\Local\npm-cache\_logs\2023-10-09T12_16_05_300Z-debug-0.log

                    command='C:\sf\nodejs\node.exe' 'C:\sf\nvm\v16.20.0\node_modules\npm\bin\npm-cli.js' rebuild nodejieba@2.5.2
                    workingDir=
npm ERR! code 1
npm ERR! path D:\proj\abc-electron
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c electron-builder install-app-deps

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\danny\AppData\Local\npm-cache\_logs\2023-10-09T12_16_02_995Z-debug-0.log
yanyiwu commented 1 month ago

用 v3.4.1 试试,应该是可以的。https://github.com/yanyiwu/nodejieba-demo

github-actions[bot] commented 4 weeks ago

This issue has been automatically closed due to inactivity. If the issue still exists, please reopen it.