关于hexo搭建博客报错的相关问题

 

首先npm i install hexo-cil会报错,但这个错误无关紧要

NIKI@DESKTOP-P1RG672 MINGW64 /d/Archer
$ npm i hexo-cli -g
npm WARN rm not removing C:\Users\NIKI\AppData\Roaming\npm\hexo.cmd as it wasn't installed by C:\Users\NIKI\AppData\Roaming\npm\node_modules\hexo-cli
npm WARN rm not removing C:\Users\NIKI\AppData\Roaming\npm\hexo as it wasn't installed by C:\Users\NIKI\AppData\Roaming\npm\node_modules\hexo-cli
C:\Users\NIKI\AppData\Roaming\npm\hexo -> C:\Users\NIKI\AppData\Roaming\npm\node_modules\hexo-cli\bin\hexo
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\hexo-cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"ia32"})

只要输入hexo -v,那么hexo即是安装成功的。

NIKI@DESKTOP-P1RG672 MINGW64 /d/Archer
$ hexo -v
hexo-cli: 2.0.0
os: Windows_NT 10.0.17134 win32 ia32
http_parser: 2.8.0
node: 10.16.3
v8: 6.8.275.32-node.54
uv: 1.28.0
zlib: 1.2.11
brotli: 1.0.7
ares: 1.15.0
modules: 64
nghttp2: 1.39.2
napi: 4
openssl: 1.1.1c
icu: 64.2
unicode: 12.1
cldr: 35.1
tz: 2019a

至于为什么之后安装的模块只有node_modules和一个json文件,我的是因为文件夹没有清空,直接在git bash里使用rm -rf *清空文件夹。

hexo init会clone 相关博客组件

这个是没有清空文件夹的情况.

NIKI@DESKTOP-P1RG672 MINGW64 /d/Archer
$ hexo init
FATAL D:\Archer not empty, please run `hexo init` on an empty folder and then copy your files into it
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Error: target not empty
    at Context.initConsole (C:\Users\NIKI\AppData\Roaming\npm\node_modules\hexo-cli\lib\console\init.js:23:27)
    at Context.tryCatcher (C:\Users\NIKI\AppData\Roaming\npm\node_modules\hexo-cli\node_modules\bluebird\js\release\util.js:16:23)
    at Context. (C:\Users\NIKI\AppData\Roaming\npm\node_modules\hexo-cli\node_modules\bluebird\js\release\method.js:15:34)
    at Promise (C:\Users\NIKI\AppData\Roaming\npm\node_modules\hexo-cli\lib\context.js:39:9)
    at Promise._execute (C:\Users\NIKI\AppData\Roaming\npm\node_modules\hexo-cli\node_modules\bluebird\js\release\debuggability.js:313:9)
    at Promise._resolveFromExecutor (C:\Users\NIKI\AppData\Roaming\npm\node_modules\hexo-cli\node_modules\bluebird\js\release\promise.js:488:18)
    at new Promise (C:\Users\NIKI\AppData\Roaming\npm\node_modules\hexo-cli\node_modules\bluebird\js\release\promise.js:79:10)
    at Context.call (C:\Users\NIKI\AppData\Roaming\npm\node_modules\hexo-cli\lib\context.js:35:10)
    at findPkg.then.then.then (C:\Users\NIKI\AppData\Roaming\npm\node_modules\hexo-cli\lib\hexo.js:67:17)
    at tryCatcher (C:\Users\NIKI\AppData\Roaming\npm\node_modules\hexo-cli\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (C:\Users\NIKI\AppData\Roaming\npm\node_modules\hexo-cli\node_modules\bluebird\js\release\promise.js:517:31)
    at Promise._settlePromise (C:\Users\NIKI\AppData\Roaming\npm\node_modules\hexo-cli\node_modules\bluebird\js\release\promise.js:574:18)
    at Promise._settlePromise0 (C:\Users\NIKI\AppData\Roaming\npm\node_modules\hexo-cli\node_modules\bluebird\js\release\promise.js:619:10)
    at Promise._settlePromises (C:\Users\NIKI\AppData\Roaming\npm\node_modules\hexo-cli\node_modules\bluebird\js\release\promise.js:699:18)
    at Promise._fulfill (C:\Users\NIKI\AppData\Roaming\npm\node_modules\hexo-cli\node_modules\bluebird\js\release\promise.js:643:18)
    at Promise._resolveCallback (C:\Users\NIKI\AppData\Roaming\npm\node_modules\hexo-cli\node_modules\bluebird\js\release\promise.js:437:57)


如果你的也是这样,只需要清空文件就行了。 

NIKI@DESKTOP-P1RG672 MINGW64 /d/Archer
$ rm -rf *

之后开始漫长且缓慢的安装(我是在进度条1%的时候写这篇博客的,也是53%的时候写完的)

NIKI@DESKTOP-P1RG672 MINGW64 /d/Archer
$ hexo init
INFO  Cloning hexo-starter https://github.com/hexojs/hexo-starter.git
Cloning into 'D:\Archer'...
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 81 (delta 0), reused 1 (delta 0), pack-reused 77
Unpacking objects: 100% (81/81), done.
Submodule 'themes/landscape' (https://github.com/hexojs/hexo-theme-landscape.git) registered for path 'themes/landscape'
Cloning into 'D:/Archer/themes/landscape'...
remote: Enumerating objects: 40, done.
remote: Counting objects: 100% (40/40), done.
remote: Compressing objects: 100% (33/33), done.
Receiving objects:  53% (549/1018), 1.86 MiB | 10.00 KiB/s

 

你可能感兴趣的:(关于hexo搭建博客报错的相关问题)