简体   繁体   中英

Grunt installed but “command not found”

I'm trying to use Grunt on a project that I'm working on with someone else. My colleague installed Node, NPM, Grunt-CLI and created a Grunt task and uploaded the entire working directory to Github. When he runs the Grunt task it works fine.

I have Yosemite 10.10.4. I've pulled down a clone of the working directory from Github. But when I try and run the Grunt task I get >> /bin/sh: mysqldump: command not found Database dump failed!

I have done the following:

  • Installed Node.js
  • Installed the command-line version of Grunt sudo npm install -g grunt-cli
  • Added the path from the Grunt installer to my $PATH export PATH=/usr/local/lib/node_modules/grunt-cli/bin:$PATH then echo $PATH which results in /usr/local/lib/node_modules/grunt-cli/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin
  • Ensured grunt is installed grunt --version results in grunt-cli v0.1.13 grunt v0.4.5
  • Installed Grunt in to the working directory cd /path/to/project/root/ followed by sudo npm install
  • Checked and ensured package.json and Gruntfile.js are in the root of the working directory (also of note that a node_modules folder has been included in the root of the working directory with my colleagues commit).

Is anyone able to help me identify the problem?

I've been following:

http://gruntjs.com/getting-started

http://www.hongkiat.com/blog/grunt-command-not-found/

As arco444 has said I needed to install the mysqldump plugin.

https://www.npmjs.com/package/grunt-mysql-dump

I hadn't realised that mysqldump was refering to a plugin, I had presumed that it was the name of the task that my colleague had created so I was just expecting that to be part of the work he had done to create the Grunt task in one of the associated configuration files.

If you're using MAMP, then mysql command line tools are not made available in your PATH automatically. For the above plugin to work, you must find out the path to these tools (On Mac OS: bundled in MAMP.app; on Windows/Linux: probably within the app's directory tree) and add that path to your PATH environment variable!

In my case that was export PATH=/Applications/MAMP/Library/bin:$PATH

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM