Heim > Fragen und Antworten > Hauptteil
在安装全局gulp时报下面的错,这个是什么原因,怎么解决的?
~ npm install -g gulp
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/gulp'
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/gulp']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/gulp',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/gulp',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR! '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53',
npm ERR! 'Object.oncomplete (fs.js:108:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 15.6.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "gulp"
npm ERR! cwd /Users/derek
npm ERR! node -v v0.10.34
npm ERR! npm -v 1.4.28
npm ERR! path /usr/local/lib/node_modules/gulp
npm ERR! fstream_path /usr/local/lib/node_modules/gulp
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/gulp'
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53
npm ERR! fstream_stack Object.oncomplete (fs.js:108:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/derek/npm-debug.log
npm ERR! not ok code
巴扎黑2017-04-17 15:29:18
Please try running this command again as root/Administrator.
翻译(请你用管理员的身份运行)sudo npm i gulp
然后输入密码 就可以了