在终端中安装 gulp 时如何解决错误“ERR!错误:EACCES:权限被拒绝,符号链接...”?

Ant*_*llo 1 terminal gulp gulp-install

我正在尝试在全球范围内安装 gulp。一开始我遇到了问题,所以我将文件的所有者从 root 更改为我的用户。但是知道我收到了这个错误,老实说这是我第一次使用终端来安装功能。我将不胜感激。谢谢。

Anthonys-MacBook-Pro:~ anthonyarguello$ npm install --g gulp-cli
npm ERR! path ../lib/node_modules/gulp-cli/bin/gulp.js
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall symlink
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/gulp-cli/bin/gulp.js' -> '/usr/local/bin/gulp'
npm ERR!  { [Error: EACCES: permission denied, symlink '../lib/node_modules/gulp-cli/bin/gulp.js' -> '/usr/local/bin/gulp']
npm ERR!   cause:
npm ERR!    { Error: EACCES: permission denied, symlink '../lib/node_modules/gulp-cli/bin/gulp.js' -> '/usr/local/bin/gulp'
npm ERR!      errno: -13,
npm ERR!      code: 'EACCES',
npm ERR!      syscall: 'symlink',
npm ERR!      path: '../lib/node_modules/gulp-cli/bin/gulp.js',
npm ERR!      dest: '/usr/local/bin/gulp' },
npm ERR!   stack:
npm ERR!    'Error: EACCES: permission denied, symlink \'../lib/node_modules/gulp-cli/bin/gulp.js\' -> \'/usr/local/bin/gulp\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../lib/node_modules/gulp-cli/bin/gulp.js',
npm ERR!   dest: '/usr/local/bin/gulp' }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/anthonyarguello/.npm/_logs/2019-06-30T00_38_52_813Z-debug.log

Run Code Online (Sandbox Code Playgroud)

安装 gulp!

Ana*_*ene 10

尝试:sudo npm install --g gulp-cli