yanyiwu / nodejieba

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

Cannot build nodejieba with Node 18 #217

Closed rbirkgit closed 4 weeks ago

rbirkgit commented 2 years ago

I tried adding "nodejieba": "~2.5.2" to my project. When using Node 16 all was good. But when using Node 18 node-pre-gyp produced errors and the install failed.

node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@1.0.10
node-pre-gyp info using node@18.9.1 | win32 | x64
node-pre-gyp info check checked for "D:\Git\automation-service\ui\node_modules\nodejieba\build\Release\nodejieba.node" (not found)
node-pre-gyp http GET https://github.com/yanyiwu/nodejieba/releases/download/v2.5.2/nodejieba-v2.5.2-node-v108-win32-x64.tar.gz
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-node-v108-win32-x64.tar.gz 
node-pre-gyp WARN Pre-built binaries not installable for nodejieba@2.5.2 and node@18.9.1 (node-v108 ABI, unknown) (falling back to source compile with node-gyp) 
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-node-v108-win32-x64.tar.gz 
gyp info it worked if it ends with ok
gyp info using node-gyp@9.1.0
gyp info using node@18.9.1 | win32 | x64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using node-gyp@9.1.0
gyp info using node@18.9.1 | win32 | x64
gyp info find Python using Python version 3.10.1 found at "D:\Install\Python\Python3\python.exe"
gyp info find VS using VS2017 (15.9.28307.858) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
gyp info find VS run with --verbose for detailed information
gyp info spawn D:\Install\Python\Python3\python.exe
gyp info spawn args [
gyp info spawn args   'D:\\Git\\automation-service\\ui\\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   'D:\\Git\\automation-service\\ui\\node_modules\\nodejieba\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\Git\\automation-service\\ui\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\rbirk\\AppData\\Local\\node-gyp\\Cache\\18.9.1\\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\\rbirk\\AppData\\Local\\node-gyp\\Cache\\18.9.1',
gyp info spawn args   '-Dnode_gyp_dir=D:\\Git\\automation-service\\ui\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\rbirk\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\18.9.1\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=D:\\Git\\automation-service\\ui\\node_modules\\nodejieba',
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   'D:\\Git\\automation-service\\ui\\node_modules\\nodejieba\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info ok 
gyp info it worked if it ends with ok
gyp info using node-gyp@9.1.0
gyp info using node@18.9.1 | win32 | x64
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
gyp info spawn args [
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'
gyp info spawn args ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  index.cpp
  nodejieba.cpp
d:\git\automation-service\ui\node_modules\nodejieba\deps\limonp\stringutil.hpp(87): error C2039: 'ptr_fun': is not a member of 'std' [D:\Git\automation-service\ui\node_modules\nodejieba\build\nodejieba.vcxproj]
  d:\git\automation-service\ui\node_modules\nodejieba\deps\limonp\stdextension.hpp(32): note: see declaration of 'std'
d:\git\automation-service\ui\node_modules\nodejieba\deps\limonp\stringutil.hpp(87): error C2065: 'ptr_fun': undeclared identifier [D:\Git\automation-service\ui\node_modules\nodejieba\build\nodejieba.vcxproj]
d:\git\automation-service\ui\node_modules\nodejieba\deps\limonp\stringutil.hpp(87): error C2062: type 'unsigned int' unexpected [D:\Git\automation-service\ui\node_modules\nodejieba\build\nodejieba.vcxproj]
d:\git\automation-service\ui\node_modules\nodejieba\deps\limonp\stringutil.hpp(92): error C2039: 'ptr_fun': is not a member of 'std' [D:\Git\automation-service\ui\node_modules\nodejieba\build\nodejieba.vcxproj]
  d:\git\automation-service\ui\node_modules\nodejieba\deps\limonp\stdextension.hpp(32): note: see declaration of 'std'
d:\git\automation-service\ui\node_modules\nodejieba\deps\limonp\stringutil.hpp(92): error C2065: 'ptr_fun': undeclared identifier [D:\Git\automation-service\ui\node_modules\nodejieba\build\nodejieba.vcxproj]
d:\git\automation-service\ui\node_modules\nodejieba\deps\limonp\stringutil.hpp(92): error C2062: type 'unsigned int' unexpected [D:\Git\automation-service\ui\node_modules\nodejieba\build\nodejieba.vcxproj]
d:\git\automation-service\ui\node_modules\nodejieba\deps\limonp\stringutil.hpp(101): error C2039: 'bind2nd': is not a member of 'std' [D:\Git\automation-service\ui\node_modules\nodejieba\build\nodejieba.vcxproj]
  d:\git\automation-service\ui\node_modules\nodejieba\deps\limonp\stdextension.hpp(32): note: see declaration of 'std'
d:\git\automation-service\ui\node_modules\nodejieba\deps\limonp\stringutil.hpp(101): error C3861: 'bind2nd': identifier not found [D:\Git\automation-service\ui\node_modules\nodejieba\build\nodejieba.vcxproj]
d:\git\automation-service\ui\node_modules\nodejieba\deps\limonp\stringutil.hpp(101): error C2672: 'std::find_if': no matching overloaded function found [D:\Git\automation-service\ui\node_modules\nodejieba\build\nodejieba.vcxproj]
d:\git\automation-service\ui\node_modules\nodejieba\deps\limonp\stringutil.hpp(101): error C2780: '_FwdIt std::find_if(_ExPo &&,_FwdIt,const _FwdIt,_Pr) noexcept': expects 4 arguments - 2 provided [D:\Git\automation-service\ui\node_modules\nodejieba\build\nodejieba.vcxproj]
  c:\program files (x86)\microsoft visual studio\2017\buildtools\vc\tools\msvc\14.16.27023\include\algorithm(189): note: see declaration of 'std::find_if'
d:\git\automation-service\ui\node_modules\nodejieba\deps\limonp\stringutil.hpp(101): error C2780: '_InIt std::find_if(_InIt,const _InIt,_Pr)': expects 3 arguments - 2 provided [D:\Git\automation-service\ui\node_modules\nodejieba\build\nodejieba.vcxproj]
  c:\program files (x86)\microsoft visual studio\2017\buildtools\vc\tools\msvc\14.16.27023\include\algorithm(167): note: see declaration of 'std::find_if'
d:\git\automation-service\ui\node_modules\nodejieba\deps\limonp\stringutil.hpp(106): error C2039: 'bind2nd': is not a member of 'std' [D:\Git\automation-service\ui\node_modules\nodejieba\build\nodejieba.vcxproj]
  d:\git\automation-service\ui\node_modules\nodejieba\deps\limonp\stdextension.hpp(32): note: see declaration of 'std'
d:\git\automation-service\ui\node_modules\nodejieba\deps\limonp\stringutil.hpp(106): error C3861: 'bind2nd': identifier not found [D:\Git\automation-service\ui\node_modules\nodejieba\build\nodejieba.vcxproj]
d:\git\automation-service\ui\node_modules\nodejieba\deps\limonp\stringutil.hpp(106): error C2672: 'std::find_if': no matching overloaded function found [D:\Git\automation-service\ui\node_modules\nodejieba\build\nodejieba.vcxproj]
d:\git\automation-service\ui\node_modules\nodejieba\deps\limonp\stringutil.hpp(106): error C2780: '_FwdIt std::find_if(_ExPo &&,_FwdIt,const _FwdIt,_Pr) noexcept': expects 4 arguments - 2 provided [D:\Git\automation-service\ui\node_modules\nodejieba\build\nodejieba.vcxproj]
  c:\program files (x86)\microsoft visual studio\2017\buildtools\vc\tools\msvc\14.16.27023\include\algorithm(189): note: see declaration of 'std::find_if'
d:\git\automation-service\ui\node_modules\nodejieba\deps\limonp\stringutil.hpp(106): error C2780: '_InIt std::find_if(_InIt,const _InIt,_Pr)': expects 3 arguments - 2 provided [D:\Git\automation-service\ui\node_modules\nodejieba\build\nodejieba.vcxproj]
  c:\program files (x86)\microsoft visual studio\2017\buildtools\vc\tools\msvc\14.16.27023\include\algorithm(167): note: see declaration of 'std::find_if'
gyp ERR! build error 
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (D:\Git\automation-service\ui\node_modules\node-gyp\lib\build.js:201:23)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Windows_NT 10.0.22000
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\Git\\automation-service\\ui\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=D:\\Git\\automation-service\\ui\\node_modules\\nodejieba\\build\\Release\\nodejieba.node" "--module_name=nodejieba" "--module_path=D:\\Git\\automation-service\\ui\\node_modules\\nodejieba\\build\\Release" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v108"
gyp ERR! cwd D:\Git\automation-service\ui\node_modules\nodejieba
gyp ERR! node -v v18.9.1
gyp ERR! node-gyp -v v9.1.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe D:\Git\automation-service\ui\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=D:\Git\automation-service\ui\node_modules\nodejieba\build\Release\nodejieba.node --module_name=nodejieba --module_path=D:\Git\automation-service\ui\node_modules\nodejieba\build\Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (D:\Git\automation-service\ui\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1091:16)
node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:302:5)
node-pre-gyp ERR! System Windows_NT 10.0.22000
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\Git\\automation-service\\ui\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd D:\Git\automation-service\ui\node_modules\nodejieba
node-pre-gyp ERR! node -v v18.9.1
node-pre-gyp ERR! node-pre-gyp -v v1.0.10
node-pre-gyp ERR! not ok 
Failed to execute 'C:\Program Files\nodejs\node.exe D:\Git\automation-service\ui\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=D:\Git\automation-service\ui\node_modules\nodejieba\build\Release\nodejieba.node --module_name=nodejieba --module_path=D:\Git\automation-service\ui\node_modules\nodejieba\build\Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
crskycode commented 1 year ago

Back to version 2.4.2, it should works. Command npm install nodejieba@2.4.2

Mister-Hope commented 1 year ago

https://github.com/yanyiwu/nodejieba/issues/223#issuecomment-1565204651

github-actions[bot] commented 1 month ago

This issue has not been updated for over 1 year and will be marked as stale. If the issue still exists, please comment or update the issue, otherwise it will be closed after 7 days.

github-actions[bot] commented 4 weeks ago

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