npm_installation

nodejs

for common use, we just type yum install nodejs is OK, but node version is low, so we need try to install latest Nodejs on CentOS

[!NOTE]
for suggestion

1
2
3
4
5
6
lynx https://nodejs.org/en/download/
wget nodejs-version.tar.gz
mkdir /opt/nodejs
./configure --prefix=/opt/nodejs
make && make install
node -v

npm

When we try to download and install some package, we hope a fast registry https://registry.npm.taobao.org.

1
2
3
[root@master ~]# npm config set registry https://registry.npm.taobao.org
[root@master ~]# npm config get registry
https://registry.npm.taobao.org/

HEXO

HEXO can help us build a blog site.

official site : HEXO
official theme : HEXO theme

1
2
3
4
5
6
7
8
-- step to init blog
[root@localhost]# npm install hexo-cli -g
[susu@localhost]$ hexo init blog
[susu@localhost]$ cd blog
npm install
hexo server
[root@localhost]# npm install --save hexo-deployer-git
[root@localhost]# hexo deploy

[!NOTE]
when you are supposed to deploy to github, make configuration.
filename: _config.yml

1
2
3
4
deploy:
type: git
repo: git@github.com:user/user.github.io.git
branch: master

hexo 相关指令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
hexo generate (hexo g) 生成静态文件
hexo server (hexo s) 启动本地服务
hexo deploy (hexo d) 提交到远程仓库
hexo new page "xx"(hexo n page) 创建页面
hexo new "xx" (hexo n "") 创建文章
hexo d -g 生成静态并提交到远程仓库
hexo s -g 生成静态文件并启动本地预览
hexo clean 清除本地 public 文件
npm install hexo-renderer-pug hexo-renderer-stylus
npm install cheerio@0.22.0 --save
npm install hexo-generator-searchdb --save
npm install hexo-tag-bootstrap --save
npm install hexo-tag-fontawesome --save
npm install hexo-deployer-git --save
npm install hexo-generator-sitemap --save
npm install hexo-generator-feed --save
npm install hexo-generator-baidu-sitemap --save