最新消息:20210917 已从crifan.com换到crifan.org

【已解决】gitbook中安装Google Adsense插件:gitbook-plugin-google-adsense

gitbook crifan 3370浏览 0评论

折腾:

【已解决】Gitbook页面底部加google adsense广告

期间,去给gitbook安装Google Adsense插件:

gitbook-plugin-google-adsense

用:

gitbook install

然后:

先去:

【未解决】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.


+ gitbook-plugin-google-adsense@0.1.0
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 npm@3.9.2 </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>└── gitbook-plugin-google-adsense@0.1.0 </p><p>info: &gt;&gt; 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>├── gitbook-plugin-google-adsense@0.1.0 </p><p>└── gitbook-plugin-theme-comscore@0.0.3 </p><p>info: &gt;&gt; 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>├─┬ gitbook-plugin-anchors@0.7.1 </p><p>│ ├─┬ cheerio@0.22.0 </p><p>│ │ ├─┬ css-select@1.2.0 </p><p>│ │ │ ├── boolbase@1.0.0 </p><p>│ │ │ ├── css-what@2.1.3 </p><p>│ │ │ ├── domutils@1.5.1 </p><p>│ │ │ └── nth-check@1.0.2 </p><p>│ │ ├─┬ dom-serializer@0.1.1 </p><p>│ │ │ └── domelementtype@1.3.1 </p><p>│ │ ├── entities@1.1.2 </p><p>│ │ ├─┬ htmlparser2@3.10.1 </p><p>│ │ │ ├── domhandler@2.4.2 </p><p>│ │ │ ├── inherits@2.0.4 </p><p>│ │ │ └─┬ readable-stream@3.4.0 </p><p>│ │ │   ├─┬ string_decoder@1.2.0 </p><p>│ │ │   │ └── safe-buffer@5.1.2 </p><p>│ │ │   └── util-deprecate@1.0.2 </p><p>│ │ ├── lodash.assignin@4.2.0 </p><p>│ │ ├── lodash.bind@4.2.1 </p><p>│ │ ├── lodash.defaults@4.2.0 </p><p>│ │ ├── lodash.filter@4.6.0 </p><p>│ │ ├── lodash.flatten@4.4.0 </p><p>│ │ ├── lodash.foreach@4.5.0 </p><p>│ │ ├── lodash.map@4.6.0 </p><p>│ │ ├── lodash.merge@4.6.1 </p><p>│ │ ├── lodash.pick@4.4.0 </p><p>│ │ ├── lodash.reduce@4.6.0 </p><p>│ │ ├── lodash.reject@4.6.0 </p><p>│ │ └── lodash.some@4.6.0 </p><p>│ └── github-slugid@1.0.1 </p><p>├── gitbook-plugin-google-adsense@0.1.0 </p><p>└── gitbook-plugin-theme-comscore@0.0.3 </p><p>info: &gt;&gt; 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>├── gitbook-plugin-anchors@0.7.1 </p><p>├── gitbook-plugin-google-adsense@0.1.0 </p><p>├─┬ gitbook-plugin-search-plus@1.0.3 </p><p>│ └── html-entities@1.2.0 </p><p>└── gitbook-plugin-theme-comscore@0.0.3 </p><p>...</p><p>info: &gt;&gt; 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>├── gitbook-plugin-anchors@0.7.1 </p><p>├─┬ gitbook-plugin-callouts@0.1.1 </p><p>│ └─┬ cheerio@0.19.0 </p><p>│   ├─┬ css-select@1.0.0 </p><p>│   │ ├── css-what@1.0.0 </p><p>│   │ └── domutils@1.4.3 </p><p>│   └─┬ htmlparser2@3.8.3 </p><p>│     ├── domhandler@2.3.0 </p><p>│     ├── domutils@1.5.1 </p><p>│     ├── entities@1.0.0 </p><p>│     └─┬ readable-stream@1.1.14 </p><p>│       ├── core-util-is@1.0.2 </p><p>│       ├── isarray@0.0.1 </p><p>│       └── string_decoder@0.10.31 </p><p>├── gitbook-plugin-copy-code-button@0.0.2 </p><p>├── gitbook-plugin-disqus@0.1.0 </p><p>├── gitbook-plugin-donate@1.0.2 </p><p>├── gitbook-plugin-expandable-chapters-small@0.1.7 </p><p>├── gitbook-plugin-ga@1.0.1 </p><p>├── gitbook-plugin-github-buttons@3.0.0 </p><p>├── gitbook-plugin-google-adsense@0.1.0 </p><p>├── gitbook-plugin-prism@2.4.0 </p><p>├── gitbook-plugin-prism-themes@0.0.2 </p><p>├── gitbook-plugin-search-plus@1.0.3 </p><p>├── gitbook-plugin-sharing-plus@0.0.2 </p><p>├── gitbook-plugin-sitemap-general@0.1.1 </p><p>├── gitbook-plugin-splitter@0.0.8 </p><p>├── gitbook-plugin-tbfed-pagefooter@0.0.1 </p><p>└── gitbook-plugin-theme-comscore@0.0.3 </p><p>info: &gt;&gt; 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>├── gitbook-plugin-anchors@0.7.1 </p><p>├─┬ gitbook-plugin-callouts@0.1.1 </p><p>│ └─┬ cheerio@0.19.0</p><p>│   └─┬ htmlparser2@3.8.3</p><p>│     └── domutils@1.5.1 </p><p>├── gitbook-plugin-copy-code-button@0.0.2 </p><p>├── gitbook-plugin-disqus@0.1.0 </p><p>├── gitbook-plugin-donate@1.0.2 </p><p>├── gitbook-plugin-expandable-chapters-small@0.1.7 </p><p>├── gitbook-plugin-ga@1.0.1 </p><p>├── gitbook-plugin-github-buttons@3.0.0 </p><p>├── gitbook-plugin-google-adsense@0.1.0 </p><p>├── gitbook-plugin-prism@2.4.0 </p><p>├── gitbook-plugin-prism-themes@0.0.2 </p><p>├── gitbook-plugin-search-plus@1.0.3 </p><p>├── gitbook-plugin-sharing-plus@0.0.2 </p><p>├── gitbook-plugin-sitemap-general@0.1.1 </p><p>├── gitbook-plugin-splitter@0.0.8 </p><p>├── gitbook-plugin-tbfed-pagefooter@0.0.1 </p><p>├── gitbook-plugin-theme-comscore@0.0.3 </p><p>└── gitbook-plugin-toolbar-button@0.0.1 </p><p>info: &gt;&gt; plugin "toolbar-button" installed with success </p>

【总结】

在加上了必要的配置后,想要安装插件,最后还是用:

gitbook install

然后等待足够长时间,安装完毕后,最后才能正常使用上插件。

转载请注明:在路上 » 【已解决】gitbook中安装Google Adsense插件:gitbook-plugin-google-adsense

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
92 queries in 0.186 seconds, using 23.34MB memory