While running hexo generate , the following error occurred:
Terminal
1 2 3 4 5 6
RangeError: Invalid string length at JSON.stringify (<anonymous>) at _Model._export (***\blog\node_modules\warehouse\dist\model.js:821:20) at ***\blog\node_modules\warehouse\dist\database.js:59:54 at Generator.next (<anonymous>) at fulfilled (***\blog\node_modules\warehouse\dist\database.js:5:58)
This was due to the V8 engine has decreased the cap of single string length from 2048MiB to 512MiB after Node 14/16. Therefore, I chose to use stream output instead and the problem resolved. I had changed the following:
// Since the V8 changed the string length cap, we need to edit the following // Starts here const self = this; function* stringifyIterator () { const keys = Object.keys(self.data); let first = true; yield'['; for (const id of keys) { const row = self.data[id]; if (!row) continue; if (!first) yield','; first = false; yieldJSON.stringify(self.schema._exportDatabase(row)); } yield']'; } returnstringifyIterator(); // <-- Return the iterator // Ends here
// Below is the Original Code /*return JSON.stringify(this.toJSON());*/ }
// Since the V8 changed the string length cap, we need to edit the following // Starts here const dataIter = models[key]._export(); // Get the Iterator if (typeof dataIter === 'string') { // Compatible with the old version buffers.push(Buffer.from(dataIter)); if (buffers.length) yield_writev(handle, buffers); } else { for (const chunk of dataIter) { // Iterate the Iterator buffers.push(Buffer.from(chunk)); // Flush once every >1 MiB to prevent buffers from getting too large if (buffers.reduce((s, b) => s + b.length, 0) > (1 << 20)) { yield_writev(handle, buffers); buffers.length = 0; } } if (buffers.length) yield_writev(handle, buffers); } // Ends here // The below is the Original Code /*buffers.push(Buffer.from(models[key]._export())); yield _writev(handle, buffers);*/
JSDelivr Loading Problem 2025-05-23
It seems that JSDelivr is not loading in China anymore. Thus, changed cdn.jsdelivr.net to testingcf.jsdelivr.net in the following code, and the problem resolved.
\blog\themes\shoka\scripts\helpers\asset.js
1 2 3 4 5 6 7
//let result = vendorJs ? `<script src="//cdn.jsdelivr.net/combine/${vendorJs}"></script>` : '';
Mixed Content: The page at 'https://hanshushao.com/About/' was loaded over HTTPS, but requested an insecure script 'http://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?version=4.8.0'. This request has been blocked; the content must be served over HTTPS.
Changed the following (HTTP -> HTTPS) and the problem resolved.
While changing to the customized icon as follows, where every original icon is well inherited, occurred a icon showing error.
\blog\themes\shoka\_config.yml
1 2
# //at.alicdn.com/t/c/font_1832207_c8i9n1ulxlt.css => 1832207_c8i9n1ulxlt iconfont:# customized icon set ID
This may due to some update by iconfont , where the source link is changed from //at.alicdn.com/t/ to //at.alicdn.com/t/c/ , thus the reference does not refer to the correct file. Original code is as follows:
In Cloud Engine section, choose Deploy from Git , and fill in https://github.com/DesertsP/Valine-Admin.git (the git respository of Valine-Admin by DessertP). Following the instruction in the respository, set the following variable in the Setting section.
Then in the Domain / Custom domains , connect to xxx.hanshushao.com , it will show a Recommended DNS config . Set the recommended confid at the domain provider as follows:
Host
Type
Priority
Value
xxx
CNAME
-
Recommended DNS config
Comment Management
Then visit https://Cloud_Engine_Name/sign-up to sign up as admin in order to manage the comments.
Code Block Align Problem 2024-12-18
The code block was aligned by a very weird way, first row of code and last row of index are indented by 1 character. By checking the element in html, it was found that the code block was indented by ::before . This is since the setting of pseudo-element pre::before is set with content: " " . By changing the following, the problem was solved.
The content in card, if no sub category, is sorted by title, which is not desired. Thus, the following change was applied to make the content in card sorted by date.