EvanNotFound / hexo-theme-redefine

Simplicity in Speed, Purity in Design: Redefine Your Hexo Journey.
https://redefine.ohevan.com
GNU General Public License v3.0
1.28k stars 97 forks source link

[BUG] 推薦功能JS包已不再支援 #369

Open CX330Blake opened 1 month ago

CX330Blake commented 1 month ago

提交 Issue 前检查清单

Bug 描述

# _config.redefine.yml
recommendation:
      # Whether to enable article recommendation
      enable: false
      # Article recommendation title
      title: Recommended Articles

我在安裝nodejieba會出現錯誤,如下

npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=D:\\GitHub\\my_site\\CX330\\node_modules\\nodejieba\\build\\Release\\nodejieba.node" "--module_name=nodejieba" "--module_path=D:\\GitHub\\my_site\\CX330\\node_modules\\nodejieba\\build\\Release" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v108"
npm ERR! gyp ERR! cwd D:\GitHub\my_site\CX330\node_modules\nodejieba
npm ERR! gyp ERR! node -v v18.18.0
npm ERR! gyp ERR! node-gyp -v v9.4.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:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=D:\GitHub\my_site\CX330\node_modules\nodejieba\build\Release\nodejieba.node --module_name=nodejieba --module_path=D:\GitHub\my_site\CX330\node_modules\nodejieba\build\Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (D:\GitHub\my_site\CX330\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:517:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1098:16)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:303:5)
npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.22631
npm ERR! node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\GitHub\\my_site\\CX330\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd D:\GitHub\my_site\CX330\node_modules\nodejieba
npm ERR! node-pre-gyp ERR! node -v v18.18.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.11
npm ERR! node-pre-gyp ERR! not ok

推測是編譯錯誤,因為ptr_fun 和 bind2nd 這些函式在 C++11 標準中已被移除。

复现方法

npm install nodejieba

预期结果

No response

截图

No response

电脑操作系统

Win11

浏览器

No response

版本

No response

移动端设备

No response

移动端操作系统

No response

浏览器

No response

版本

No response

其他

No response

EvanNotFound commented 3 weeks ago

使用 2.5.2 版本的 nodejieba

npm install nodejieba@2.5.2
CX330Blake commented 3 weeks ago

感謝您的回覆!但是在我嘗試過後問題沒有解決,還是會跳出一樣的error message。


275 error D:\GitHub\MyBlog\cx330\node_modules\nodejieba\deps\limonp\StringUtil.hpp(87,70): error C2039: 'ptr_fun': �ëD 'std' ������ [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error D:\GitHub\MyBlog\cx330\node_modules\nodejieba\deps\limonp\StdExtension.hpp(32): message : �аѾ\ 'std' ���ŧi [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error D:\GitHub\MyBlog\cx330\node_modules\nodejieba\deps\limonp\StringUtil.hpp(87,77): error C2065: 'ptr_fun': ���ŧi���ѧO�� [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error D:\GitHub\MyBlog\cx330\node_modules\nodejieba\deps\limonp\StringUtil.hpp(87,78): error C2062: ���w�������� 'unsigned int' [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error D:\GitHub\MyBlog\cx330\node_modules\nodejieba\deps\limonp\StringUtil.hpp(92,61): error C2039: 'ptr_fun': �ëD 'std' ������ [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error D:\GitHub\MyBlog\cx330\node_modules\nodejieba\deps\limonp\StdExtension.hpp(32): message : �аѾ\ 'std' ���ŧi [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error D:\GitHub\MyBlog\cx330\node_modules\nodejieba\deps\limonp\StringUtil.hpp(92,68): error C2065: 'ptr_fun': ���ŧi���ѧO�� [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error D:\GitHub\MyBlog\cx330\node_modules\nodejieba\deps\limonp\StringUtil.hpp(92,69): error C2062: ���w�������� 'unsigned int' [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error D:\GitHub\MyBlog\cx330\node_modules\nodejieba\deps\limonp\StringUtil.hpp(101,70): error C2039: 'bind2nd': �ëD 'std' ������ [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error D:\GitHub\MyBlog\cx330\node_modules\nodejieba\deps\limonp\StdExtension.hpp(32): message : �аѾ\ 'std' ���ŧi [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error D:\GitHub\MyBlog\cx330\node_modules\nodejieba\deps\limonp\StringUtil.hpp(101,77): error C3861: 'bind2nd': �䤣���ѧO�� [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error D:\GitHub\MyBlog\cx330\node_modules\nodejieba\deps\limonp\StringUtil.hpp(101,27): error C2672: 'std::find_if': �䤣��۲Ū��h���禡 [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error D:\GitHub\MyBlog\cx330\node_modules\nodejieba\deps\limonp\StringUtil.hpp(101,104): error C2780: '_FwdIt std::find_if(_ExPo &&,_FwdIt,const _FwdIt,_Pr) noexcept': ������ 4 �Ӥ޼� - �u���ѤF 2 �� [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include\algorithm(348): message : �аѾ\ 'std::find_if' ���ŧi [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error D:\GitHub\MyBlog\cx330\node_modules\nodejieba\deps\limonp\StringUtil.hpp(101,104): error C2780: '_InIt std::find_if(_InIt,const _InIt,_Pr)': ������ 3 �Ӥ޼� - �u���ѤF 2 �� [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include\xutility(5527): message : �аѾ\ 'std::find_if' ���ŧi [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error D:\GitHub\MyBlog\cx330\node_modules\nodejieba\deps\limonp\StringUtil.hpp(106,61): error C2039: 'bind2nd': �ëD 'std' ������ [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error D:\GitHub\MyBlog\cx330\node_modules\nodejieba\deps\limonp\StdExtension.hpp(32): message : �аѾ\ 'std' ���ŧi [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error D:\GitHub\MyBlog\cx330\node_modules\nodejieba\deps\limonp\StringUtil.hpp(106,68): error C3861: 'bind2nd': �䤣���ѧO�� [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error D:\GitHub\MyBlog\cx330\node_modules\nodejieba\deps\limonp\StringUtil.hpp(106,16): error C2672: 'std::find_if': �䤣��۲Ū��h���禡 [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error D:\GitHub\MyBlog\cx330\node_modules\nodejieba\deps\limonp\StringUtil.hpp(106,95): error C2780: '_FwdIt std::find_if(_ExPo &&,_FwdIt,const _FwdIt,_Pr) noexcept': ������ 4 �Ӥ޼� - �u���ѤF 2 �� [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include\algorithm(348): message : �аѾ\ 'std::find_if' ���ŧi [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error D:\GitHub\MyBlog\cx330\node_modules\nodejieba\deps\limonp\StringUtil.hpp(106,95): error C2780: '_InIt std::find_if(_InIt,const _InIt,_Pr)': ������ 3 �Ӥ޼� - �u���ѤF 2 �� [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include\xutility(5527): message : �аѾ\ 'std::find_if' ���ŧi [D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\nodejieba.vcxproj]
275 error Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\Release\nodejieba.node --module_name=nodejieba --module_path=D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
276 error node-pre-gyp info it worked if it ends with ok
276 error node-pre-gyp info using node-pre-gyp@1.0.11
276 error node-pre-gyp info using node@18.18.0 | win32 | x64
276 error node-pre-gyp info check checked for "D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\Release\nodejieba.node" (not found)
276 error 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
276 error 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 
276 error node-pre-gyp WARN Pre-built binaries not installable for nodejieba@2.5.2 and node@18.18.0 (node-v108 ABI, unknown) (falling back to source compile with node-gyp) 
276 error 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 
276 error gyp info it worked if it ends with ok
276 error gyp info using node-gyp@9.4.0
276 error gyp info using node@18.18.0 | win32 | x64
276 error gyp info ok 
276 error gyp info it worked if it ends with ok
276 error gyp info using node-gyp@9.4.0
276 error gyp info using node@18.18.0 | win32 | x64
276 error gyp info find Python using Python version 3.9.10 found at "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\opt\bin\python3.exe"
276 error gyp info find VS using VS2019 (16.11.34031.81) found at:
276 error gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
276 error gyp info find VS run with --verbose for detailed information
276 error gyp info spawn C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\opt\bin\python3.exe
276 error gyp info spawn args [
276 error gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
276 error gyp info spawn args   'binding.gyp',
276 error gyp info spawn args   '-f',
276 error gyp info spawn args   'msvs',
276 error gyp info spawn args   '-I',
276 error gyp info spawn args   'D:\\GitHub\\MyBlog\\cx330\\node_modules\\nodejieba\\build\\config.gypi',
276 error gyp info spawn args   '-I',
276 error gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
276 error gyp info spawn args   '-I',
276 error gyp info spawn args   'C:\\Users\\user\\AppData\\Local\\node-gyp\\Cache\\18.18.0\\include\\node\\common.gypi',
276 error gyp info spawn args   '-Dlibrary=shared_library',
276 error gyp info spawn args   '-Dvisibility=default',
276 error gyp info spawn args   '-Dnode_root_dir=C:\\Users\\user\\AppData\\Local\\node-gyp\\Cache\\18.18.0',
276 error gyp info spawn args   '-Dnode_gyp_dir=C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp',
276 error gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\user\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\18.18.0\\\\<(target_arch)\\\\node.lib',
276 error gyp info spawn args   '-Dmodule_root_dir=D:\\GitHub\\MyBlog\\cx330\\node_modules\\nodejieba',
276 error gyp info spawn args   '-Dnode_engine=v8',
276 error gyp info spawn args   '--depth=.',
276 error gyp info spawn args   '--no-parallel',
276 error gyp info spawn args   '--generator-output',
276 error gyp info spawn args   'D:\\GitHub\\MyBlog\\cx330\\node_modules\\nodejieba\\build',
276 error gyp info spawn args   '-Goutput_dir=.'
276 error gyp info spawn args ]
276 error gyp info ok 
276 error gyp info it worked if it ends with ok
276 error gyp info using node-gyp@9.4.0
276 error gyp info using node@18.18.0 | win32 | x64
276 error gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe
276 error gyp info spawn args [
276 error gyp info spawn args   'build/binding.sln',
276 error gyp info spawn args   '/clp:Verbosity=minimal',
276 error gyp info spawn args   '/nologo',
276 error gyp info spawn args   '/p:Configuration=Release;Platform=x64'
276 error gyp info spawn args ]
276 error gyp ERR! build error 
276 error gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
276 error gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:203:23)
276 error gyp ERR! stack     at ChildProcess.emit (node:events:517:28)
276 error gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:292:12)
276 error gyp ERR! System Windows_NT 10.0.22631
276 error gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=D:\\GitHub\\MyBlog\\cx330\\node_modules\\nodejieba\\build\\Release\\nodejieba.node" "--module_name=nodejieba" "--module_path=D:\\GitHub\\MyBlog\\cx330\\node_modules\\nodejieba\\build\\Release" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v108"
276 error gyp ERR! cwd D:\GitHub\MyBlog\cx330\node_modules\nodejieba
276 error gyp ERR! node -v v18.18.0
276 error gyp ERR! node-gyp -v v9.4.0
276 error gyp ERR! not ok 
276 error node-pre-gyp ERR! build error 
276 error node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\Release\nodejieba.node --module_name=nodejieba --module_path=D:\GitHub\MyBlog\cx330\node_modules\nodejieba\build\Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
276 error node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (D:\GitHub\MyBlog\cx330\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23)
276 error node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:517:28)
276 error node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1098:16)
276 error node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:303:5)
276 error node-pre-gyp ERR! System Windows_NT 10.0.22631
276 error node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\GitHub\\MyBlog\\cx330\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
276 error node-pre-gyp ERR! cwd D:\GitHub\MyBlog\cx330\node_modules\nodejieba
276 error node-pre-gyp ERR! node -v v18.18.0
276 error node-pre-gyp ERR! node-pre-gyp -v v1.0.11
276 error node-pre-gyp ERR! not ok
277 verbose exit 1
278 timing npm Completed in 6135ms
279 verbose unfinished npm timer reify 1717035718016
280 verbose unfinished npm timer reify:build 1717035719071
281 verbose unfinished npm timer build 1717035719071
282 verbose unfinished npm timer build:deps 1717035719072
283 verbose unfinished npm timer build:run:install 1717035719081
284 verbose unfinished npm timer build:run:install:node_modules/nodejieba 1717035719081
285 verbose code 1
286 error A complete log of this run can be found in: C:\Users\user\AppData\Local\npm-cache\_logs\2024-05-30T02_21_57_641Z-debug-0.log
wkk-dev commented 3 weeks ago

经测试,使用linux安装是可行的,也可以用github actions,例如 VSCode(git推送)→github (存储)→github action (拉取编译)→action (构建部署)→(静态托管) 亲测可行如图 我的博客

过去问题#335