查看现在的版本
1
2$ node -v
v10.15.0使用brew install升级,提示错误【无法创建链接 /usr/local/bin/node】,node -v版本无变化
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
35
36
37
38
39
40
41
42
43
44
45
46$ brew install node
==> Auto-updating Homebrew...
Adjust how often this is run with HOMEBREW_AUTO_UPDATE_SECS or disable with
HOMEBREW_NO_AUTO_UPDATE. Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Auto-updated Homebrew!
==> Updated Homebrew from 4.3.18 (2971755498) to 4.3.23 (29c22e0ab3).
...
==> Pouring openssl@3--3.3.2.sequoia.bottle.tar.gz
🍺 /usr/local/Cellar/openssl@3/3.3.2: 6,984 files, 32.9MB
==> Installing node
==> Pouring node--22.9.0.sonoma.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/node
Target /usr/local/bin/node
already exists. You may want to remove it:
rm '/usr/local/bin/node'
To force the link and overwrite all conflicting files:
brew link --overwrite node
To list all files that would be deleted:
brew link --overwrite node --dry-run
Possible conflicting files are:
...
Warning: The post-install step did not complete successfully
You can try again using:
brew postinstall node
Warning: Removed Sorbet lines from backtrace!
Rerun with `--verbose` to see the original backtrace
==> Caveats
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
==> Summary
🍺 /usr/local/Cellar/node/22.9.0: 2,064 files, 79.0MB
==> Running `brew cleanup node`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Caveats
==> node
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
$ node -v
v10.15.0尝试提示的命令,无法解决问题
1
2
3
4
5$ brew link --overwrite node
Linking /usr/local/Cellar/node/22.9.0...
Error: Could not symlink include/node/common.gypi
/usr/local/include/node is not writable.解决方法:修改旧node相关目录的权限,重新建立链接。
1
2
3
4
5
6$ sudo chown -R $USER /usr/local/include/node/
$ sudo chown -R $USER /usr/local/share/doc/node
$ brew link --overwrite node
Linking /usr/local/Cellar/node/22.9.0... 69 symlinks created.
$ node -v
v22.9.0升级npm到最新版本时报错。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16$ npm -v
6.4.1
$ npm install -g npm@latest
npm WARN npm npm does not support Node.js v22.9.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11.
npm WARN npm You can find the latest version at https://nodejs.org/
(node:19671) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:19671) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
npm ERR! cb.apply is not a function
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/aes/.npm/_logs/2024-09-21T00_19_02_958Z-debug.log解决方法: 删除npm的相关目录,重新安装node
1
2
3
4
5
6
7
8$ sudo rm -rf /usr/local/bin/npm
$ sudo rm -rf /usr/local/lib/node_modules
$ rm -rf ~/.npm
$ brew reinstall node
$ node -v
v22.9.0
$ npm -v
10.8.3hexo简单搭建
1
2
3
4
5
6
7
8$ npm install -g hexo-cli
$ hexo init blog
-bash: hexo: command not found
# 可以用下面目录下的命令解决
$ ~/.npm-global/bin/hexo init blog
$ cd blog
$ ~/.npm-global/bin/hexo g
$ ~/.npm-global/bin/hexo s