嘗試通過hexo + github創建個人博客的時候,輸入hexo init命令,出現下面的報錯。看起來這是兩個報錯,在之前的命令中,只有依賴安裝失敗,而沒有ssl驗證失敗的錯誤,經過我的一番調試調試才出現了后者。
INFO Cloning hexo-starter https://github.com/hexojs/hexo-starter.git fatal: unable to access 'https://github.com/hexojs/hexo-starter.git/': OpenSSL SSL_read: Connection was reset, errno 10054 WARN git clone failed. Copying data instead INFO Install dependencies WARN Failed to install dependencies. Please run 'npm install' in "D:\TheNewLife\LearningNotes\Blog" folder.
第一個問題解決:
git config --global http.sslVerify "false"
確實,穿越守衛最好的方法就是把守衛打死。這樣之后,又回到的最初的起點:依賴安裝失敗。
第二個問題解決:
npm install
在報錯的最后一行,系統提示輸入"npm install",其實卡了這么久我自己的原因很大,我還以為它是騙我的,輸入這個能有啥用呢?
確實是有用的,又有new error了。
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated npm ERR! code 1 npm ERR! path D:\TheNewLife\LearningNotes\GithubBlog\node_modules\canvas npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild npm ERR! Warning: Missing input files: npm ERR! C:\GTK\bin\libgobject-2.0-0.dll npm ERR! C:\GTK\bin\libpangowin32-1.0-0.dll npm ERR! C:\GTK\bin\libintl-8.dll npm ERR! C:\GTK\bin\libfreetype-6.dll npm ERR! C:\GTK\bin\libpangocairo-1.0-0.dll npm ERR! C:\GTK\bin\libpng14-14.dll npm ERR! C:\GTK\bin\libcairo-2.dll npm ERR! C:\GTK\bin\libfontconfig-1.dll npm ERR! C:\GTK\bin\libgmodule-2.0-0.dll npm ERR! C:\GTK\bin\libpango-1.0-0.dll npm ERR! C:\GTK\bin\libpangoft2-1.0-0.dll npm ERR! C:\GTK\bin\libgthread-2.0-0.dll npm ERR! C:\GTK\bin\libexpat-1.dll npm ERR! C:\GTK\bin\libglib-2.0-0.dll npm ERR! C:\GTK\bin\zlib1.dll npm ERR! �ڴ˽��������һ������һ����Ŀ����Ҫ���ò������ɣ������ӡ�-m�����ء� npm ERR! Backend.cc npm ERR! D:\TheNewLife\LearningNotes\GithubBlog\node_modules\canvas\src\backend\Backend.h(3,10): fatal error C1083: �������ļ�: ��cairo.h��: No such file or directory [D:\The New Life\Learning Notes\Github Blog\nod e_modules\canvas\build\canvas.vcxproj] npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@7.1.2 npm ERR! gyp info using node@16.9.0 | win32 | x64 npm ERR! gyp info find Python using Python version 3.6.8 found at "D:\Python36\python.exe" npm ERR! gyp info find VS using VS2019 (16.8.30907.101) found at: npm ERR! gyp info find VS "D:\Microsoft Visual Studio\2019\Community" npm ERR! gyp info find VS run with --verbose for detailed information npm ERR! (node:8296) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only. npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created) npm ERR! gyp info spawn D:\Python36\python.exe npm ERR! gyp info spawn args [ npm ERR! gyp info spawn args 'D:\\node-v16.9.0-x64\\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:\\TheNewLife\\LearningNotes\\GithubBlog\\node_modules\\canvas\\build\\config.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args 'D:\\node-v16.9.0-x64\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args 'C:\\Users\\jq\\AppData\\Local\\node-gyp\\Cache\\16.9.0\\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\\jq\\AppData\\Local\\node-gyp\\Cache\\16.9.0', npm ERR! gyp info spawn args '-Dnode_gyp_dir=D:\\node-v16.9.0-x64\\node_modules\\npm\\node_modules\\node-gyp', npm ERR! gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\jq\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\16.9.0\\\\<(target_arch)\\\\node.lib', npm ERR! gyp info spawn args '-Dmodule_root_dir=D:\\The New Life\\Learning Notes\\Github Blog\\node_modules\\canvas', 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:\\TheNewLife\\LearningNotes\\GithubBlog\\node_modules\\canvas\\build', npm ERR! gyp info spawn args '-Goutput_dir=.' npm ERR! gyp info spawn args ] npm ERR! gyp info spawn D:\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: `D:\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1 npm ERR! gyp ERR! stack at ChildProcess.onExit (D:\node-v16.9.0-x64\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23) npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:394:28) npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) npm ERR! gyp ERR! System Windows_NT 10.0.19042 npm ERR! gyp ERR! command "D:\\node-v16.9.0-x64\\node.exe" "D:\\node-v16.9.0-x64\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd D:\TheNewLife\LearningNotes\GithubBlog\node_modules\canvas npm ERR! gyp ERR! node -v v16.9.0 npm ERR! gyp ERR! node-gyp -v v7.1.2 npm ERR! gyp ERR! not ok npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\jq\AppData\Local\npm-cache\_logs\2021-09-11T02_26_30_524Z-debug.log
到這里為止,我已經完全不知道這是什么問題了。遇到這種嚴重走偏的時刻,我會選擇重頭做一次,重新發現問題,但是這次我選擇用cnpm,以上命令均用cnpm代替。截至此時,我還不知道cnpm是什么,搜了下才知道是淘寶團隊造福大眾的工具。使用cnpm,能看到安裝與初始化的完整進程(比npm好多了),雖然我是第一次用這個東西。
使用cnpm install代替npm后,依然報了一些WARNING,搜了下,應該是可以忽略的問題。所以就接着操作了...
————————————————————————————————————————————————————————————————————————————————————————————
很遺憾沒有找到代碼行的折疊工具,通篇有3/4是報錯,我覺得是應該有的,或應該是有的,如果有朋友看到了,麻煩告知一聲,不勝感激。