sudo npm install -g @vue/cli --u
sudo npm install -g @vue/cli
> fsevents@1.2.13 install /usr/local/lib/node_modules/@vue/cli/node_modules/fsevents
> node install.js
gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/Users/lilulu/Library/Caches/node-gyp/14.17.6"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/@vue/cli/node_modules/fsevents/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@vue/cli/node_modules/fsevents/.node-gyp'
gyp ERR! System Darwin 18.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/@vue/cli/node_modules/fsevents
gyp ERR! node -v v14.17.6
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
> core-js-pure@3.17.3 postinstall /usr/local/lib/node_modules/@vue/cli/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"
解决:sudo npm install -g @vue/cli --unsafe-perm