next-theme / hexo-theme-next

🎉 Elegant and powerful theme for Hexo.
https://theme-next.js.org
Other
2.48k stars 438 forks source link

Vendor error of algoliasearch #543

Closed hominsu closed 2 years ago

hominsu commented 2 years ago

Issue Checklist


While I'm using local vendor and algolia_search at the same time, some errors occur (I'm used git to install the next theme and use "@next-theme/plugins": "^8.12.2" to provide internal script locally)

As you can see, @next-theme/plugins are not found the algoliasearch/dist/algoliasearch-lite.umd.js

> hexo-site@0.0.0 build
> hexo generate

INFO  Validating config
INFO  ==================================
  ███╗   ██╗███████╗██╗  ██╗████████╗
  ████╗  ██║██╔════╝╚██╗██╔╝╚══██╔══╝
  ██╔██╗ ██║█████╗   ╚███╔╝    ██║
  ██║╚██╗██║██╔══╝   ██╔██╗    ██║
  ██║ ╚████║███████╗██╔╝ ██╗   ██║
  ╚═╝  ╚═══╝╚══════╝╚═╝  ╚═╝   ╚═╝
========================================
NexT version 8.12.2
Documentation: https://theme-next.js.org
========================================
INFO  Start processing
INFO  neat the css: E:\blog-hexo\source\_data\styles.styl [ 16.83% saved]
INFO  neat the css: E:\blog-hexo\source\_data\variables.styl [ NaN% saved]
WARN  The following packages are not found by `@next-theme/plugins`.
WARN  ENOENT: no such file or directory, stat 'E:\blog-hexo\node_modules\/algoliasearch/dist/algoliasearch-lite.umd.js'
WARN  Maybe you can find the solution here: https://github.com/next-theme/plugins#debug
INFO  Files loaded in 10 s

Search function is not available on the website

image

I check the algoliasearch/dist in node_modules, you can see the the script is named algoliasearchLite.js not algoliasearch-lite.umd.js

image

Author's description on https://www.npmjs.com/package/hexo-algolia also indicates the algoliasearchLite.min.js is used to include Algolia JavaScript Client

<script src="/assets/algolia/algoliasearchLite.min.js" async></script>

Environment Information

I'm using node v16.14.0 and npm@8.13.2

Package dependencies Information

hexo-site@0.0.0 E:\blog-hexo
+-- @next-theme/plugins@8.12.2
+-- hexo-abbrlink@2.2.1
+-- hexo-algolia@1.3.2
+-- hexo-deployer-git@3.0.0
+-- hexo-generator-archive@1.0.0
+-- hexo-generator-baidu-sitemap@0.1.9
+-- hexo-generator-category@1.0.0
+-- hexo-generator-feed@3.0.0
+-- hexo-generator-index@2.0.0
+-- hexo-generator-sitemap@3.0.1
+-- hexo-generator-tag@1.0.0
+-- hexo-neat@1.0.9
+-- hexo-optimize@2.5.1
+-- hexo-pangu@0.2.1
+-- hexo-renderer-ejs@2.0.0
+-- hexo-renderer-marked@5.0.0
+-- hexo-renderer-stylus@2.1.0
+-- hexo-server@3.0.0
+-- hexo-symbols-count-time@0.7.1
+-- hexo-tag-aplayer@3.0.4
`-- hexo@6.2.0
welcome[bot] commented 2 years ago

Thanks for opening this issue, maintainers will get back to you as soon as possible!

hominsu commented 2 years ago

Modified the file and integrity, everything is fine

algolia_search:
  name: algoliasearch
  version: 4.13.1
- file: dist/algoliasearch-lite.umd.js
- integrity: sha256-g68T2rU86flpyzVWWCcZxWGWISTfOXVwEpZgyKOaZ1c=
+ file: dist/algoliasearchLite.js
+ integrity: sha256-Lo1hgzpep12pGfO8ze7kq63+xtFp5zNuoEjQbclVP6I=
instant_search:
  name: instantsearch.js
  version: 4.43.0
hominsu commented 2 years ago

I submitted a Pull Request #544, algoliasearch is now available on my site: www.hauhau.cn

njzjz commented 2 years ago

We may need unit tests to make sure it works.

hominsu commented 2 years ago

We may need unit tests to make sure it works.

You mean add a test suite to check if file in _vendor.yml exist?

stevenjoezhang commented 2 years ago

The current management of dependency package versions relies on manual review, e.g. https://github.com/next-theme/plugins/pull/166 Maybe we need to find a more automated way

hominsu commented 2 years ago

The current management of dependency package versions relies on manual review, e.g. next-theme/plugins#166 Maybe we need to find a more automated way

Got it. In hexo-algolia, it use an older algoliasearch, so it caused this error. but in hexo-algoliasearch it use latest version, so it works. May be using some automated method to provide internal scripts locally is better.

Thanks so much

github-actions[bot] commented 1 year ago

This thread has been automatically locked since there has not been any recent activity after it was closed. It is possible issue was solved or at least outdated. Feel free to open new for related bugs.