Npm 在非全局安装中使用Grunt

Npm 在非全局安装中使用Grunt,npm,gruntjs,Npm,Gruntjs,在尝试在不安装全局依赖项的情况下构建jQuery的自定义版本时,我遇到了以下问题: $ node --version v0.10.4 $ npm --version 1.2.18 $ git clone git://github.com/jquery/jquery.git $ cd jquery $ git checkout `git describe --abbrev=0 --tags` # latest tag $ npm install $ npm install grunt-cli

在尝试在不安装全局依赖项的情况下构建jQuery的自定义版本时,我遇到了以下问题:

$ node --version
v0.10.4
$ npm --version
1.2.18

$ git clone git://github.com/jquery/jquery.git
$ cd jquery
$ git checkout `git describe --abbrev=0 --tags` # latest tag
$ npm install
$ npm install grunt-cli

# variant A
$ npm run-script grunt custom:-ajax # does nothing

# variant B
$ node_modules/.bin/grunt custom:-ajax
Running "custom:-ajax" (custom) task
Creating custom build...
Warning: Error: not found: grunt Use --force to continue.
Aborted due to warnings.

我以前很少使用Grunt或Node,所以这里缺少什么?

这是因为jQuery自定义任务如何生成Grunt。我刚刚发送了一个拉取请求,可以解决此问题: