折腾:
【已解决】Gitbook页面底部加google adsense广告
期间,去给gitbook安装Google Adsense插件:
gitbook-plugin-google-adsense
用:
gitbook install
然后:
先去:
中断了,因为也还是好半天没进展。
然后确保这次node_modules是当前的独立的目录(不是之前的ln的软连接了)
换用
npm install gitbook-plugin-google-adsense
试试
➜ gitbook_demo npm install gitbook-plugin-google-adsense npm WARN saveError ENOENT: no such file or directory, open '/Users/crifan/dev/dev_root/gitbook/gitbook_src_root/books/gitbook_demo/package.json' npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN enoent ENOENT: no such file or directory, open '/Users/crifan/dev/dev_root/gitbook/gitbook_src_root/books/gitbook_demo/package.json' npm WARN gitbook_demo No description npm WARN gitbook_demo No repository field. npm WARN gitbook_demo No README data npm WARN gitbook_demo No license field. + [email protected] added 13 packages from 9 contributors and audited 261 packages in 4.237s found 6 vulnerabilities (3 low, 3 high) run `npm audit fix` to fix them, or `npm audit` for details
但是已经安装到当前目录了:
不过也还是去看看什么情况
➜ gitbook_demo npm audit fix npm ERR! code EAUDITNOPJSON npm ERR! audit No package.json found: Cannot audit a project without a package.json npm ERR! A complete log of this run can be found in: npm ERR! /Users/crifan/.npm/_logs/2019-06-27T14_53_11_198Z-debug.log ➜ gitbook_demo npm audit npm ERR! code EAUDITNOPJSON npm ERR! audit No package.json found: Cannot audit a project without a package.json npm ERR! A complete log of this run can be found in: npm ERR! /Users/crifan/.npm/_logs/2019-06-27T14_53_17_608Z-debug.log
放弃,不管了。
gitbook install <p>info: installing 18 plugins using [email protected] </p><p>info: </p><p>info: installing plugin "google-adsense" </p><p>info: install plugin "google-adsense" (*) from NPM with version 0.1.0 </p><p>/Users/crifan/dev/dev_root/gitbook/gitbook_src_root/books/gitbook_demo</p><p>└── [email protected] </p><p>info: >> plugin "google-adsense" installed with success </p><p>info: </p><p>info: installing plugin "theme-comscore" </p><p>runTopLevelLifecycles → g ▌ ╢█████████████████████████████████████████████████████████████████████████████████████░░░╟</p><p>/Users/crifan/dev/dev_root/gitbook/gitbook_src_root/books/gitbook_demo</p><p>├── [email protected] </p><p>└── [email protected] </p><p>info: >> plugin "theme-comscore" installed with success </p><p>info: </p><p>info: installing plugin "anchors" </p><p>runTopLevelLifecycles → e ▌ ╢█████████████████████████████████████████████████████████████████████████████████████░░░╟</p><p>/Users/crifan/dev/dev_root/gitbook/gitbook_src_root/books/gitbook_demo</p><p>├─┬ [email protected] </p><p>│ ├─┬ [email protected] </p><p>│ │ ├─┬ [email protected] </p><p>│ │ │ ├── [email protected] </p><p>│ │ │ ├── [email protected] </p><p>│ │ │ ├── [email protected] </p><p>│ │ │ └── [email protected] </p><p>│ │ ├─┬ [email protected] </p><p>│ │ │ └── [email protected] </p><p>│ │ ├── [email protected] </p><p>│ │ ├─┬ [email protected] </p><p>│ │ │ ├── [email protected] </p><p>│ │ │ ├── [email protected] </p><p>│ │ │ └─┬ [email protected] </p><p>│ │ │ ├─┬ [email protected] </p><p>│ │ │ │ └── [email protected] </p><p>│ │ │ └── [email protected] </p><p>│ │ ├── [email protected] </p><p>│ │ ├── [email protected] </p><p>│ │ ├── [email protected] </p><p>│ │ ├── [email protected] </p><p>│ │ ├── [email protected] </p><p>│ │ ├── [email protected] </p><p>│ │ ├── [email protected] </p><p>│ │ ├── [email protected] </p><p>│ │ ├── [email protected] </p><p>│ │ ├── [email protected] </p><p>│ │ ├── [email protected] </p><p>│ │ └── [email protected] </p><p>│ └── [email protected] </p><p>├── [email protected] </p><p>└── [email protected] </p><p>info: >> plugin "anchors" installed with success </p><p>info: </p><p>info: installing plugin "search-plus" </p><p>runTopLevelLifecycles → e ▌ ╢█████████████████████████████████████████████████████████████████████████████████████░░░╟</p><p>/Users/crifan/dev/dev_root/gitbook/gitbook_src_root/books/gitbook_demo</p><p>├── [email protected] </p><p>├── [email protected] </p><p>├─┬ [email protected] </p><p>│ └── [email protected] </p><p>└── [email protected] </p><p>...</p><p>info: >> plugin "copy-code-button" installed with success </p><p>info: </p><p>info: installing plugin "callouts" </p><p>runTopLevelLifecycles → g ▄ ╢█████████████████████████████████████████████████████████████████████████████████████░░░╟</p><p>/Users/crifan/dev/dev_root/gitbook/gitbook_src_root/books/gitbook_demo</p><p>├── [email protected] </p><p>├─┬ [email protected] </p><p>│ └─┬ [email protected] </p><p>│ ├─┬ [email protected] </p><p>│ │ ├── [email protected] </p><p>│ │ └── [email protected] </p><p>│ └─┬ [email protected] </p><p>│ ├── [email protected] </p><p>│ ├── [email protected] </p><p>│ ├── [email protected] </p><p>│ └─┬ [email protected] </p><p>│ ├── [email protected] </p><p>│ ├── [email protected] </p><p>│ └── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>└── [email protected] </p><p>info: >> plugin "callouts" installed with success </p><p>info: </p><p>info: installing plugin "toolbar-button" </p><p>runTopLevelLifecycles → e ▐ ╢█████████████████████████████████████████████████████████████████████████████████████░░░╟</p><p>/Users/crifan/dev/dev_root/gitbook/gitbook_src_root/books/gitbook_demo</p><p>├── [email protected] </p><p>├─┬ [email protected] </p><p>│ └─┬ [email protected]</p><p>│ └─┬ [email protected]</p><p>│ └── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>├── [email protected] </p><p>└── [email protected] </p><p>info: >> plugin "toolbar-button" installed with success </p>
【总结】
在加上了必要的配置后,想要安装插件,最后还是用:
gitbook install
然后等待足够长时间,安装完毕后,最后才能正常使用上插件。
转载请注明:在路上 » 【已解决】gitbook中安装Google Adsense插件:gitbook-plugin-google-adsense