在克里斯科伊尔的帖子的启发下,我决定放弃咕噜咕噜.但是我在设置方面遇到了很大的问题.
首先,我安装了Node.
然后我将package.json文件添加到我的项目根目录,包括:
{ "name": "example-project", "version": "0.1.0", "devDependencies": { "grunt": "~0.4.1" } }
然后我跑了 npm install
最后,我跑了 npm install -g grunt-cli
它带来了大量的错误:
npm http GET https://registry.npmjs.org/grunt-cli npm http 304 https://registry.npmjs.org/grunt-cli npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/grunt-cli' npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/grunt-cli'] npm ERR! errno: 3, npm ERR! code: 'EACCES', npm ERR! path: '/usr/local/lib/node_modules/grunt-cli', npm ERR! fstream_type: 'Directory', npm ERR! fstream_path: '/usr/local/lib/node_modules/grunt-cli', 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:37:53', npm ERR! 'Object.oncomplete (fs.js:107:15)' ] } npm ERR! npm ERR! Please try running this command again as root/Administrator. npm ERR! System Darwin 11.4.2 npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "grunt-cli" npm ERR! cwd /Users/bryce/repo npm ERR! node -v v0.10.23 npm ERR! npm -v 1.3.17 npm ERR! path /usr/local/lib/node_modules/grunt-cli npm ERR! fstream_path /usr/local/lib/node_modules/grunt-cli 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/grunt-cli' 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:37:53 npm ERR! fstream_stack Object.oncomplete (fs.js:107:15) npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /Users/bryce/repo/npm-debug.log npm ERR! not ok code 0 Bryce:repo bryce$ npm install -g grunt-cli npm http GET https://registry.npmjs.org/grunt-cli npm http 304 https://registry.npmjs.org/grunt-cli npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/grunt-cli' npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/grunt-cli'] npm ERR! errno: 3, npm ERR! code: 'EACCES', npm ERR! path: '/usr/local/lib/node_modules/grunt-cli', npm ERR! fstream_type: 'Directory', npm ERR! fstream_path: '/usr/local/lib/node_modules/grunt-cli', 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:37:53', npm ERR! 'Object.oncomplete (fs.js:107:15)' ] } npm ERR! npm ERR! Please try running this command again as root/Administrator. npm ERR! System Darwin 11.4.2 npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "grunt-cli" npm ERR! cwd /Users/bryce/repo npm ERR! node -v v0.10.23 npm ERR! npm -v 1.3.17 npm ERR! path /usr/local/lib/node_modules/grunt-cli npm ERR! fstream_path /usr/local/lib/node_modules/grunt-cli 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/grunt-cli' 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:37:53 npm ERR! fstream_stack Object.oncomplete (fs.js:107:15) npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /Users/bryce/repo/npm-debug.log npm ERR! not ok code 0
我认为上述错误是我尝试运行的原因grunt
,我只是得到了-bash: grunt: command not found
那里的任何人都知道发生了什么?