GitBook on FreeBSD?
Matthias Apitz
guru at unixarea.de
Sun Oct 18 10:01:14 UTC 2015
El día Saturday, October 17, 2015 a las 04:04:23PM -0500, Brandon J. Wandersee escribió:
> This isn't a good idea.
>
> https://docs.npmjs.com/getting-started/installing-npm-packages-locally
>
> Note that I don't use Node.js myself, so if those instructions cause
> problems I'm afraid I can't help. I just figured that just as Python
> eggs, Ruby gems, and Haskell Cabal packages can be installed locally as
> a regular user, so can Node packages. It seems that's the case.
Thanks! The video is not very instructive, esp. if one has never used
Node. But, it gave me the idea that somehow a local installation is
supported. I deduced to let away the flag '-g' (globally) and came up
at the end with the following procedure to build a GitBooks locally:
Install the npm - node package manager, from the FreeBSD' ports www/npm:
# cd /usr/local/www/npm
# make install clean
Here is how to use 'npm' to install the GitBook gitbook-cli to create local
web trees of a GitBook
$ cd UbuntuPhone
we will instaall gitbook-cli not globally, but in a local folder 'npm':
$ mkdir npm
$ cd npm
$ npm install gitbook-cli
gitbook-cli at 1.0.0 node_modules/gitbook-cli
├── bash-color at 0.0.3
├── semver at 5.0.1
├── q at 1.4.1
├── commander at 2.8.1 (graceful-readlink at 1.0.1)
├── tmp at 0.0.27 (os-tmpdir at 1.0.1)
├── user-home at 2.0.0 (os-homedir at 1.0.1)
├── optimist at 0.6.1 (wordwrap at 0.0.3, minimist at 0.0.10)
├── npmi at 1.0.1 (semver at 4.3.6)
├── lodash at 3.10.1
├── fs-extra at 0.24.0 (path-is-absolute at 1.0.0, jsonfile at 2.2.3, graceful-fs at 4.1.2, rimraf at 2.4.3)
└── npm at 2.14.8
Now let's go to our GitBook and build a local web tree from it:
$ cd ../bq-aquaris-e-4-5-ubuntu-phone # where my GitBook files are
$ ../npm/node_modules/.bin/gitbook build
Installing GitBook 2.4.x
...
info: loading book configuration....OK
info: load plugin gitbook-plugin-highlight ....OK
info: >> 1 plugins loaded
info: start generation with website generator
info: clean website generator
info: OK
info: generation is finished
Done, without error
$ find _book/
_book/
_book/chapter23.html
...
_book/index.html
_book/chapter24.html
$ firefox _book/index.html
fine :-)
--
Matthias Apitz, ✉ guru at unixarea.de, 🌐 http://www.unixarea.de/ ☎ +49-176-38902045
More information about the freebsd-questions
mailing list