{"id":161,"date":"2020-05-05T17:20:35","date_gmt":"2020-05-05T08:20:35","guid":{"rendered":"https:\/\/chen.za.net\/?p=161"},"modified":"2020-05-05T17:20:35","modified_gmt":"2020-05-05T08:20:35","slug":"hexo-init","status":"publish","type":"post","link":"https:\/\/chen.za.net\/?p=161","title":{"rendered":"Hexo\u5b89\u88c5"},"content":{"rendered":"<h3 id=\"\u5b89\u88c5\u524d\u63d0\" class=\"article-heading\">\u5b89\u88c5\u524d\u63d0<\/h3>\n<p>\u5b89\u88c5 Hexo \u76f8\u5f53\u7b80\u5355\uff0c\u53ea\u9700\u8981\u5148\u5b89\u88c5\u4e0b\u5217\u5e94\u7528\u7a0b\u5e8f\u5373\u53ef\uff1a<\/p>\n<ul>\n<li><a href=\"http:\/\/nodejs.org\/\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\">Node.js<\/a>\u00a0(Node.js \u7248\u672c\u9700\u4e0d\u4f4e\u4e8e 8.10\uff0c\u5efa\u8bae\u4f7f\u7528 Node.js 10.0 \u53ca\u4ee5\u4e0a\u7248\u672c)<\/li>\n<li><a href=\"http:\/\/git-scm.com\/\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\">Git<\/a><\/li>\n<\/ul>\n<p>\u5982\u679c\u60a8\u7684\u7535\u8111\u4e2d\u5df2\u7ecf\u5b89\u88c5\u4e0a\u8ff0\u5fc5\u5907\u7a0b\u5e8f\uff0c\u90a3\u4e48\u606d\u559c\u60a8\uff01\u4f60\u53ef\u4ee5\u76f4\u63a5\u524d\u5f80\u00a0<a href=\"https:\/\/hexo.io\/zh-cn\/docs\/#%E5%AE%89%E8%A3%85-Hexo\">\u5b89\u88c5 Hexo<\/a>\u00a0\u6b65\u9aa4\u3002<\/p>\n<p>\u5982\u679c\u60a8\u7684\u7535\u8111\u4e2d\u5c1a\u672a\u5b89\u88c5\u6240\u9700\u8981\u7684\u7a0b\u5e8f\uff0c\u8bf7\u6839\u636e\u4ee5\u4e0b\u5b89\u88c5\u6307\u793a\u5b8c\u6210\u5b89\u88c5\u3002<\/p>\n<h3 id=\"\u5b89\u88c5-Git\" class=\"article-heading\">\u5b89\u88c5 Git<\/h3>\n<ul>\n<li>Windows\uff1a\u4e0b\u8f7d\u5e76\u5b89\u88c5\u00a0<a href=\"https:\/\/git-scm.com\/download\/win\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\">git<\/a>.<\/li>\n<li>Mac\uff1a\u4f7f\u7528\u00a0<a href=\"http:\/\/mxcl.github.com\/homebrew\/\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\">Homebrew<\/a>,\u00a0<a href=\"http:\/\/www.macports.org\/\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\">MacPorts<\/a>\u00a0\u6216\u8005\u4e0b\u8f7d\u00a0<a href=\"http:\/\/sourceforge.net\/projects\/git-osx-installer\/\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\">\u5b89\u88c5\u7a0b\u5e8f<\/a>\u3002<\/li>\n<li>Linux (Ubuntu, Debian)\uff1a<code>sudo apt-get install git-core<\/code><\/li>\n<li>Linux (Fedora, Red Hat, CentOS)\uff1a<code>sudo yum install git-core<\/code><\/li>\n<\/ul>\n<blockquote class=\"note warn\"><p><strong class=\"note-title\">Mac \u7528\u6237<\/strong>\u5982\u679c\u5728\u7f16\u8bd1\u65f6\u53ef\u80fd\u4f1a\u9047\u5230\u95ee\u9898\uff0c\u8bf7\u5148\u5230 App Store \u5b89\u88c5 Xcode\uff0cXcode \u5b8c\u6210\u540e\uff0c\u542f\u52a8\u5e76\u8fdb\u5165\u00a0<strong>Preferences -&gt; Download -&gt; Command Line Tools -&gt; Install<\/strong>\u00a0\u5b89\u88c5\u547d\u4ee4\u884c\u5de5\u5177\u3002<\/p><\/blockquote>\n<blockquote class=\"note info\"><p><strong class=\"note-title\">Windows \u7528\u6237<\/strong>\u5bf9\u4e8e\u4e2d\u56fd\u5927\u9646\u5730\u533a\u7528\u6237\uff0c\u53ef\u4ee5\u524d\u5f80\u00a0<a href=\"https:\/\/npm.taobao.org\/mirrors\/git-for-windows\/\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\">\u6dd8\u5b9d Git for Windows \u955c\u50cf<\/a>\u00a0\u4e0b\u8f7d git \u5b89\u88c5\u5305\u3002<\/p><\/blockquote>\n<h3 id=\"\u5b89\u88c5-Node-js\" class=\"article-heading\">\u5b89\u88c5 Node.js<\/h3>\n<p>Node.js \u4e3a\u5927\u591a\u6570\u5e73\u53f0\u63d0\u4f9b\u4e86\u5b98\u65b9\u7684\u00a0<a href=\"https:\/\/nodejs.org\/en\/download\/\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\">\u5b89\u88c5\u7a0b\u5e8f<\/a>\u3002\u5bf9\u4e8e\u4e2d\u56fd\u5927\u9646\u5730\u533a\u7528\u6237\uff0c\u53ef\u4ee5\u524d\u5f80\u00a0<a href=\"https:\/\/npm.taobao.org\/mirrors\/node\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\">\u6dd8\u5b9d Node.js \u955c\u50cf<\/a>\u00a0\u4e0b\u8f7d\u3002<\/p>\n<p>\u5176\u5b83\u7684\u5b89\u88c5\u65b9\u6cd5\uff1a<\/p>\n<ul>\n<li>Windows\uff1a\u901a\u8fc7\u00a0<a href=\"https:\/\/github.com\/jasongin\/nvs\/\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\">nvs<\/a>\uff08\u63a8\u8350\uff09\u6216\u8005<a href=\"https:\/\/github.com\/nvm-sh\/nvm\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\">nvm<\/a>\u00a0\u5b89\u88c5\u3002<\/li>\n<li>Mac\uff1a\u4f7f\u7528\u00a0<a href=\"https:\/\/brew.sh\/\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\">Homebrew<\/a>\u00a0\u6216\u00a0<a href=\"http:\/\/www.macports.org\/\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\">MacPorts<\/a>\u00a0\u5b89\u88c5\u3002<\/li>\n<li>Linux\uff08DEB\/RPM-based\uff09\uff1a\u4ece\u00a0<a href=\"https:\/\/github.com\/nodesource\/distributions\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\">NodeSource<\/a>\u00a0\u5b89\u88c5\u3002<\/li>\n<li>\u5176\u5b83\uff1a\u4f7f\u7528\u76f8\u5e94\u7684\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668\u8fdb\u884c\u5b89\u88c5\uff0c\u53ef\u4ee5\u53c2\u8003\u7531 Node.js \u63d0\u4f9b\u7684\u00a0<a href=\"https:\/\/nodejs.org\/en\/download\/package-manager\/\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\">\u6307\u5bfc<\/a><\/li>\n<\/ul>\n<p>\u5bf9\u4e8e Mac \u548c Linux \u540c\u6837\u5efa\u8bae\u4f7f\u7528 nvs \u6216\u8005 nvm\uff0c\u4ee5\u907f\u514d\u53ef\u80fd\u4f1a\u51fa\u73b0\u7684\u6743\u9650\u95ee\u9898\u3002<\/p>\n<blockquote class=\"note info\"><p><strong class=\"note-title\">Windows \u7528\u6237<\/strong>\u4f7f\u7528 Node.js \u5b98\u65b9\u5b89\u88c5\u7a0b\u5e8f\u65f6\uff0c\u8bf7\u786e\u4fdd\u52fe\u9009\u00a0<strong>Add to PATH<\/strong>\u00a0\u9009\u9879\uff08\u9ed8\u8ba4\u5df2\u52fe\u9009\uff09<\/p><\/blockquote>\n<blockquote class=\"note warn\"><p><strong class=\"note-title\">For Mac \/ Linux \u7528\u6237<\/strong>\u5982\u679c\u5728\u5c1d\u8bd5\u5b89\u88c5 Hexo \u7684\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u00a0<code>EACCES<\/code>\u00a0\u6743\u9650\u9519\u8bef\uff0c\u8bf7\u9075\u5faa\u00a0<a href=\"https:\/\/docs.npmjs.com\/resolving-eacces-permissions-errors-when-installing-packages-globally\" target=\"_blank\" rel=\"noopener external nofollow noreferrer\">\u7531 npmjs \u53d1\u5e03\u7684\u6307\u5bfc<\/a>\u00a0\u4fee\u590d\u8be5\u95ee\u9898\u3002\u5f3a\u70c8\u5efa\u8bae\u00a0<strong>\u4e0d\u8981<\/strong>\u00a0\u4f7f\u7528 root\u3001sudo \u7b49\u65b9\u6cd5\u8986\u76d6\u6743\u9650<\/p><\/blockquote>\n<h3 id=\"\u5b89\u88c5-Hexo\" class=\"article-heading\">\u5b89\u88c5 Hexo<\/h3>\n<p>\u6240\u6709\u5fc5\u5907\u7684\u5e94\u7528\u7a0b\u5e8f\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u5373\u53ef\u4f7f\u7528 npm \u5b89\u88c5 Hexo\u3002<\/p>\n<figure class=\"highlight bash\">\n<table>\n<tbody>\n<tr>\n<td class=\"code\">\n<pre><span class=\"line\">$ npm install -g hexo-cli<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<h3 id=\"\u8fdb\u9636\u5b89\u88c5\u548c\u4f7f\u7528\" class=\"article-heading\">\u8fdb\u9636\u5b89\u88c5\u548c\u4f7f\u7528<\/h3>\n<p>\u5bf9\u4e8e\u719f\u6089 npm \u7684\u8fdb\u9636\u7528\u6237\uff0c\u53ef\u4ee5\u4ec5\u5c40\u90e8\u5b89\u88c5\u00a0<code>hexo<\/code>\u00a0\u5305\u3002<\/p>\n<figure class=\"highlight bash\">\n<table>\n<tbody>\n<tr>\n<td class=\"code\">\n<pre><span class=\"line\">$ npm install hexo<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<p>\u5b89\u88c5\u4ee5\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4e24\u79cd\u65b9\u5f0f\u6267\u884c Hexo\uff1a<\/p>\n<ol>\n<li><code>npx hexo &lt;command&gt;<\/code><\/li>\n<li>\u5c06 Hexo \u6240\u5728\u7684\u76ee\u5f55\u4e0b\u7684\u00a0<code>node_modules<\/code>\u00a0\u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf\u4e4b\u4e2d\u5373\u53ef\u76f4\u63a5\u4f7f\u7528\u00a0<code>hexo &lt;command&gt;<\/code>\uff1a<br \/>\n<figure class=\"highlight bash\">\n<table>\n<tbody>\n<tr>\n<td class=\"code\">\n<pre><span class=\"line\"><span class=\"built_in\">echo<\/span> <span class=\"string\">'PATH=\"$PATH:.\/node_modules\/.bin\"'<\/span> &gt;&gt; ~\/.profile<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u5b89\u88c5\u524d\u63d0 \u5b89\u88c5 Hexo \u76f8\u5f53\u7b80\u5355\uff0c\u53ea\u9700\u8981\u5148\u5b89\u88c5\u4e0b\u5217\u5e94\u7528\u7a0b\u5e8f\u5373\u53ef\uff1a Node.js\u00a0(Node.js \u7248\u672c\u9700\u4e0d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-161","post","type-post","status-publish","format-standard","hentry","category-blog"],"_links":{"self":[{"href":"https:\/\/chen.za.net\/index.php?rest_route=\/wp\/v2\/posts\/161","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chen.za.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chen.za.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chen.za.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chen.za.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=161"}],"version-history":[{"count":0,"href":"https:\/\/chen.za.net\/index.php?rest_route=\/wp\/v2\/posts\/161\/revisions"}],"wp:attachment":[{"href":"https:\/\/chen.za.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chen.za.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chen.za.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}