hexo deploy TypeError [ERR_INVALID_ARG_TYPE]

When deploy to GitHub pages, got the follow error

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
INFO  ==================================
███╗ ██╗███████╗██╗ ██╗████████╗
████╗ ██║██╔════╝╚██╗██╔╝╚══██╔══╝
██╔██╗ ██║█████╗ ╚███╔╝ ██║
██║╚██╗██║██╔══╝ ██╔██╗ ██║
██║ ╚████║███████╗██╔╝ ██╗ ██║
╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝ ╚═╝
========================================
NexT version 8.8.1
Documentation: https://theme-next.js.org
========================================
INFO Deploying: git
INFO Clearing .deploy_git folder...
INFO Copying files from public folder...
FATAL {
err: TypeError [ERR_INVALID_ARG_TYPE]: The "mode" argument must be integer. Received an instance of Object
at copyFile (node:fs:2774:10)

Found the root cause is node version is too high. downgraded to node12 will solve the issue.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
hexo -v                                    2 ↵  2791  23:55:19
INFO Validating config
WARN Deprecated config detected: "external_link" with a Boolean value is deprecated. See https://hexo.io/docs/configuration for more details.
INFO ==================================
███╗ ██╗███████╗██╗ ██╗████████╗
████╗ ██║██╔════╝╚██╗██╔╝╚══██╔══╝
██╔██╗ ██║█████╗ ╚███╔╝ ██║
██║╚██╗██║██╔══╝ ██╔██╗ ██║
██║ ╚████║███████╗██╔╝ ██╗ ██║
╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝ ╚═╝
========================================
NexT version 8.8.1
Documentation: https://theme-next.js.org
========================================
hexo: 5.4.0
hexo-cli: 2.0.0
os: Darwin 21.4.0 darwin x64
node: 16.13.1
v8: 9.4.146.24-node.14
uv: 1.42.0
zlib: 1.2.11
brotli: 1.0.9
ares: 1.18.1
modules: 93
nghttp2: 1.45.1
napi: 8
llhttp: 6.0.4
openssl: 1.1.1l+quic
cldr: 39.0
icu: 69.1
tz: 2021a
unicode: 13.0
ngtcp2: 0.1.0-DEV
nghttp3: 0.1.0-DEV

Run the following commands to downgrade node for MacOS

1
2
3
4
5
6
7
8
9
10
11
brew search node                           
==> Formulae
libbitcoin-node llnode node-build node@10 node@14 node_exporter nodeenv ode
linode-cli node ✔ node-sass node@12 node@16 ✔ nodebrew nodenv

brew unlink node
brew install node@12
sudo brew link --overwrite node@12
or
echo 'export PATH="/usr/local/opt/node@12/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc