关于hexo init过程中出现fail to install dependencies的解决


  尝试通过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是报错,我觉得是应该有的,或应该是有的,如果有朋友看到了,麻烦告知一声,不胜感激。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM