mirror of https://gitlab.com/curben/blog
docs: use $PATH method so --global npm installation is not required
This commit is contained in:
parent
883b18caa4
commit
6cd4456d9a
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
title: How to create a Hexo blog
|
title: How to create a Hexo blog
|
||||||
date: 2018-09-21 00:00:00
|
date: 2018-09-21 00:00:00
|
||||||
lastUpdated: 2018-10-07 00:00:00
|
lastUpdated: 2018-11-06 00:00:00
|
||||||
tags:
|
tags:
|
||||||
---
|
---
|
||||||
Create a website/blog (hosted by [GitLab](https://about.gitlab.com/features/pages/) for free) using the following guide:
|
Create a website/blog (hosted by [GitLab](https://about.gitlab.com/features/pages/) for free) using the following guide:
|
||||||
|
@ -48,11 +48,11 @@ $ sudo yum -y install nodejs
|
||||||
# Arch Linux
|
# Arch Linux
|
||||||
$ sudo pacman -S npm
|
$ sudo pacman -S npm
|
||||||
```
|
```
|
||||||
4. Install Hexo and its dependencies (defined in `package.json`). Re-launch the terminal program before continue.
|
4. Install Hexo and its dependencies (defined in `package.json`). Re-launch the terminal program before continue. After installation, append `node_modules/.bin` to $PATH.
|
||||||
```bash
|
```bash
|
||||||
$ cd <folder>
|
$ cd <folder>
|
||||||
$ sudo npm install -g hexo-cli
|
|
||||||
$ npm install
|
$ npm install
|
||||||
|
$ echo 'PATH="./node_modules/.bin:$PATH"' >> ~/.profile
|
||||||
```
|
```
|
||||||
5. Generate static files to check for any error. You should always do this before pushing/merging commits to the `master` branch.
|
5. Generate static files to check for any error. You should always do this before pushing/merging commits to the `master` branch.
|
||||||
```bash
|
```bash
|
||||||
|
@ -60,7 +60,6 @@ $ hexo generate
|
||||||
```
|
```
|
||||||
6. (Optional) Start Hexo server on localhost:4000 to preview the blog. ([more info](https://hexo.io/docs/server))
|
6. (Optional) Start Hexo server on localhost:4000 to preview the blog. ([more info](https://hexo.io/docs/server))
|
||||||
```bash
|
```bash
|
||||||
$ npm install hexo-server --save
|
|
||||||
$ hexo server
|
$ hexo server
|
||||||
```
|
```
|
||||||
7. Commit the changes and push them. The generated `public` and `node_modules` are [ignored](https://gitlab.com/curben/blog/blob/master/.gitignore), as CI will generate them during build.
|
7. Commit the changes and push them. The generated `public` and `node_modules` are [ignored](https://gitlab.com/curben/blog/blob/master/.gitignore), as CI will generate them during build.
|
||||||
|
|
|
@ -34,7 +34,12 @@ Practically, you can use Snyk to patch it, *if* possible like this [hexo-all-min
|
||||||
2. Snyk only supports [SSO](https://en.wikipedia.org/wiki/Single_sign-on), no e-mail sign up. You need to have GitHub, Bitbucket, or Google account. It can be a separate account from your current GitHub account. Linking your current GitHub repo to Snyk is *optional*.
|
2. Snyk only supports [SSO](https://en.wikipedia.org/wiki/Single_sign-on), no e-mail sign up. You need to have GitHub, Bitbucket, or Google account. It can be a separate account from your current GitHub account. Linking your current GitHub repo to Snyk is *optional*.
|
||||||
3. Once you signed up, go to your account setting, grab the API token and save it in your password manager (or somewhere safe).
|
3. Once you signed up, go to your account setting, grab the API token and save it in your password manager (or somewhere safe).
|
||||||
{% cloudinary 20181001/snyk-api.png %}
|
{% cloudinary 20181001/snyk-api.png %}
|
||||||
4. Install Snyk, `$ sudo npm install -g snyk`.
|
4. Install Snyk,
|
||||||
|
```bash
|
||||||
|
$ npm install snyk
|
||||||
|
# Add 'node_modules/.bin' to $PATH, if you haven't done so. Check ~/.profile before running the following command.
|
||||||
|
$ echo 'PATH="./node_modules/.bin:$PATH"' >> ~/.profile
|
||||||
|
```
|
||||||
5. `cd` into your repo folder.
|
5. `cd` into your repo folder.
|
||||||
6. Login to Snyk, `$ snyk auth`. Snyk website will pop-up.
|
6. Login to Snyk, `$ snyk auth`. Snyk website will pop-up.
|
||||||
7. Once authenticated, you can start to use it.
|
7. Once authenticated, you can start to use it.
|
||||||
|
|
Loading…
Reference in New Issue