好久没打开博客了,某天已看搜索不能用了,重新按照上面的步骤操作,发现流程不太一样了。
一、处理
- 尝试命令:hexo algolia,报错
1 | INFO Validating config |
参考连接进行处理
- algolia
- 注册/登录algolia
- 创建应用
- 创建索引
- 取配置:右上角->Setting->Team and Access->API Keys
- Application ID
- Search API Key
- Write API Key
- Admin API Key
项目更改
- npm install hexo-algoliasearch –save
- 修改配置文件_config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15algolia:
appId: "Z7A3XW4R2I"
apiKey: "12db1ad54372045549ef465881c17e743"
adminApiKey: "40321c7c207e7f73b63a19aa24c4761b"
chunkSize: 5000
indexName: "my-hexo-blog"
fields:
- content:strip:truncate,0,500
- excerpt:strip
- gallery
- permalink
- photos
- slug
- tags
- titlehexo algolia
二、问题
rm node_modules && npm install –force –verbose,各种报错
1
2
3
4
5
6
7
8
9
10npm http fetch GET https://registry.nlark.com/statuses/download/statuses-1.5.0.tgz attempt 3 failed with ECONNRESET
npm http fetch GET https://registry.nlark.com/urllib/download/urllib-2.11.1.tgz attempt 3 failed with ECONNRESET
npm http fetch GET https://registry.nlark.com/strip-ansi/download/strip-ansi-6.0.0.tgz attempt 3 failed with ECONNRESET
npm http fetch GET https://registry.nlark.com/tildify/download/tildify-2.0.0.tgz?cache=0&sync_timestamp=1628772896453&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ftildify%2Fdownload%2Ftildify-2.0.0.tgz attempt 3 failed with ECONNRESET
npm http fetch GET https://registry.nlark.com/semver/download/semver-6.3.0.tgz attempt 3 failed with ECONNRESET
npm http fetch GET https://registry.nlark.com/util/download/util-0.10.4.tgz?cache=0&sync_timestamp=1622213272480&other_urls=https%3A%2F%2Fregistry.nlark.com%2Futil%2Fdownload%2Futil-0.10.4.tgz attempt 3 failed with ECONNRESET
npm http fetch GET https://registry.nlark.com/supports-color/download/supports-color-7.2.0.tgz?cache=0&sync_timestamp=1626703414084&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fsupports-color%2Fdownload%2Fsupports-color-7.2.0.tgz attempt 3 failed with ECONNRESET
npm http fetch GET https://registry.nlark.com/debug/download/debug-3.1.0.tgz attempt 3 failed with ECONNRESET
npm http fetch GET https://registry.nlark.com/striptags/download/striptags-3.2.0.tgz attempt 3 failed with ECONNRESET
npm http fetch GET https://registry.nlark.com/strip-indent/download/strip-indent-3.0.0.tgz attempt 3 failed with ECONNRESET- 修改源:npm config set registry https://registry.npmmirror.com
- 设置代理:
- npm config set proxy http://127.0.0.1:7890
- npm config set https-proxy http://127.0.0.1:7890
hexo algolia报错
- ERROR [hexo-algolia] Please set an
HEXO_ALGOLIA_INDEXING_KEY
environment variable to enable content indexing. - ERROR >> Read https://npmjs.com/hexo-algolia#api-key for more informations.
- 处理:
- 方案1:使用git bash执行
- 方案2:添加环境变量:HEXO_ALGOLIA_INDEXING_KEY adminKey
- Administrator的用户变量
- 参考
- ERROR [hexo-algolia] Please set an
页面点击搜索报错:{name: ‘AlgoliaSearchError’, message: ‘Please provide an application ID. Usage: algoliasearch(applicationID, apiKey, opts)’, stack: ‘AlgoliaSearchError: Please provide an application …://liusir.me/js/algolia-search.js?v=7.4.1.js:6:16’}
- 在主配置_config.yml下加入一下
1
2plugins:
- hexo-algoliasearch- 还是报错,修改如下再次发布,恢复正常(applicationID)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16algolia:
appId: "xxx"
applicationID: 'xxx'
apiKey: "eee"
adminApiKey: "eee"
chunkSize: 5000
indexName: "blog"
fields:
- content:strip:truncate,0,500
- excerpt:strip
- gallery
- permalink
- photos
- slug
- tags
- title- hexo g -d
- hexo algolia