0%

修复 brew node 安装

问题

1
2
3
$ npm -v

env: node: No such file or directory

解决方案

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$ brew uninstall --force node
$ brew uninstall --force npm

$ brew install node

$ brew link --overwrite node

$ npm install hexo-cli

npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /Users/<user name>/.npm/_cacache/index-v5/a5/25
npm ERR! errno -13
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 501:20 "/Users/<user name>/.npm"

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/<user name>/.npm/_logs/<time stamp>-debug.log

$ chown -R 501:20 "/Users/<user name>/.npm"