vscode项目中的环境搭建在终端输入后2老有问题

quan$ npm install
Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/quan/.npm/_cacache/index-v5/03/6a’on-sho

Unhandled rejection Error: EACCES: permission denied, mkdir ‘/Users/quan/.npm/_cacache/content-v2/sha512/0b/a9’

Unhandled rejection Error: EACCES: permission denied, mkdir ‘/Users/quan/.npm/_cacache/content-v2/sha512/0b/ac’

Unhandled rejection Error: EACCES: permission denied, mkdir ‘/Users/quan/.npm/_cacache/content-v2/sha512/0b/e0’

Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/quan/.npm/_cacache/index-v5/03/c6’rs/qua

Unhandled rejection Error: EACCES: permission denied, mkdir ‘/Users/quan/.npm/_cacache/content-v2/sha512/0b/e6’

Unhandled rejection Error: EACCES: permission denied, mkdir ‘/Users/quan/.npm/_cacache/content-v2/sha512/0b/8a’

Unhandled rejection Error: EACCES: permission denied, mkdir ‘/Users/quan/.npm/_cacache/content-v2/sha512/0b/8a’

Unhandled rejection Error: EACCES: permission denied, mkdir ‘/Users/quan/.npm/_cacache/content-v2/sha512/0b/00’

Unhandled rejection Error: EACCES: permission denied, mkdir ‘/Users/quan/.npm/_cacache/content-v2/sha512/0b/a1’

npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! https://npm.community

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/quan/.npm/_logs/2019-07-16T02_49_08_916Z-debug.log

There is an open issue with installing global packages using sudo leaving behind files with the wrong ownership.

The short version is run this to fix the ownership, then try your install again:

sudo chown -R $(whoami) ~/.npm