Solve Error: Console expects a writable stream instance
When running hexo server
, you might get the following error:
console.js:35
throw new TypeError('Console expects a writable stream instance');
^
TypeError: Console expects a writable stream instance
at new Console (console.js:35:11)
at Object.<anonymous> (/Users/YourAlias/.nvm/versions/node/v8.9.0/lib/node_modules/hexo/node_modules/hexo-log/lib/log.js:31:17)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/YourAlias/.nvm/versions/node/v8.9.0/lib/node_modules/hexo/node_modules/hexo-cli/lib/context.js:3:16)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
This is because your node version is too old, hexo 5 depends on node version >= 10.13.0.
Solution:
Run nvm ls-remote
, and find the version you want to update to.
Run nvm install 15.6.0
, will update to v15.6.0.