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-feed
andhexo-generator-sitemap
is incompatible withHexo 3
someone 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-feed
repo:- Hexo 4: 2.x
- Hexo 3: 1.x
- Hexo 2: 0.x
- While my version in
package.json
is"hexo": "^3.2.0"
and"hexo-generator-feed": "^1.2.2"
. I am guessing that updatehexo
andhexo-generator-feed
might 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.js
is needed for updating Hexo. - I forgot how I install my
node
originally. Here reinstalled it as followswhich node
sudo rm -rf /usr/local/bin/node
sudo rm -rf /usr/loca/lib/node_modules/npm/
brew doctor
brew cleanup --prune-prefix
brew install node
- Uninstall node.js on OSX.
Brew link node
- Then I try to make the link use the command
brew link node
which 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.json
and use the commandnpm update
in 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.js
is too high and we need to downgrade it. - Downgrading through
brew
brew unlink node
brew install node@12
brew 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.json
and runnpm install
ornpm update
. All the packages are insidenode_modules
. - An alternative: yarn