Update Hexo
At first, all I want is making the asset folder work, then I tried to update hexo and met a series of problem and got them solved.
Conflication of hexo-generator-feed and hexo 3
Problem
The first problem I met is shown as following 1
2Template render error: (unknown path) [Line 8, Column 25]
Error: Unable to call `the return value of (posts["first"])["updated"]["toISOString"]`, which is undefined or falsey
Solution
I found a issue stating the same problem and it was answered that the plugin
hexo-generator-feedandhexo-generator-sitemapis incompatible withHexo 3someone uninstalls these plugins to solve the problem which doesn't work for me as maupassant-hexo requires
hexo-generator-feed.- As stated in the
hexo-generator-feedrepo:- Hexo 4: 2.x
- Hexo 3: 1.x
- Hexo 2: 0.x
- While my version in
package.jsonis"hexo": "^3.2.0"and"hexo-generator-feed": "^1.2.2". I am guessing that updatehexoandhexo-generator-feedmight help solve the problem. - And yes, when I have Hexo: 4.2.1 and hexo-generator-feed: 2.2.0, it is solved automatically.
npm rebuild node-sass --force.
Updating node and Hexo
Updating Node.js
- Newer version of
node.jsis needed for updating Hexo. - I forgot how I install my
nodeoriginally. Here reinstalled it as followswhich nodesudo rm -rf /usr/local/bin/nodesudo rm -rf /usr/loca/lib/node_modules/npm/brew doctorbrew cleanup --prune-prefixbrew install node
- Uninstall node.js on OSX.
Brew link node
- Then I try to make the link use the command
brew link nodewhich shed me the errorError: Could not symlink include/node/common.gypi. - The solution is here
- Then I met the problem when using
npm, giving me the errormodeule.js:538 throw err;- This is solved by reinstalling the node using homebrew.
Update hexo
- modify the
package.jsonand use the commandnpm updatein the terminal.
Downgrading node
- When I try to deploy
hexo d, it gave me the errorTypeError [ERR_INVALID_ARG_TYPE]: The "mode" argument must be integer. Received an instance of Object - This is because the version of
Node.jsis too high and we need to downgrade it. - Downgrading through
brewbrew unlink nodebrew install node@12brew link node@12: failedbrew link --overwrite node@12
About Node.js & NPM
Node.js
Node.js wiki > Node.js is an open-source, cross-platform, JavaScript runtime environment that executes JavaScript code outside a web browser.
- About Node.js, JavaScript runtime, asynchronous event-driven, concurrency etc.
- tutorialspoint - introduction to Node.js
npm
- node.js package manager.
- write packages needed into
package.jsonand runnpm installornpm update. All the packages are insidenode_modules. - An alternative: yarn