MacOS npm安装vue-cli报错

npm install -g @vue/cli

问题如下:

gyp ERR! configure error

gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@vue/cli/node_modules/fsevents/build'

gyp ERR! System Darwin 19.4.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 v10.16.0

gyp ERR! node-gyp -v v3.8.0

gyp ERR! not ok

解决办法:

执行 sudo npm install @vue/cli -g

输入秘密 解决!

你可能感兴趣的:(MacOS npm安装vue-cli报错)