【问题标题】:Unable to build jquery with grunt - submodule error无法使用 grunt 构建 jquery - 子模块错误
【发布时间】:2013-01-10 09:51:33
【问题描述】:

我没有运气使用 grunt 构建 jQuery (git)。

一切都很顺利,直到实际的 grunt 命令输出如下:

grunt --config Gruntfile.js 

Running "update_submodules" task

TypeError: Cannot call method 'spawn' of undefined
at Object.<anonymous> (/Users/maciejbodek/Dropbox/Htdocs/git/jquery/node_modules/grunt-update-submodules/tasks/update-submodules.js:7:14)
at Object.task.registerTask.thisTask.fn (/usr/local/lib/node_modules/grunt/lib/grunt/task.js:58:16)
at Task.<anonymous> (/usr/local/lib/node_modules/grunt/lib/util/task.js:343:36)
at Task.start (/usr/local/lib/node_modules/grunt/lib/util/task.js:359:5)
at Object.grunt.tasks (/usr/local/lib/node_modules/grunt/lib/grunt.js:143:8)
at Object.module.exports [as cli] (/usr/local/lib/node_modules/grunt/lib/grunt/cli.js:36:9)
at Object.<anonymous> (/usr/local/lib/node_modules/grunt/bin/grunt:19:14)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)

任何提示表示赞赏。安装了所有需要的 npm 依赖等等。只是构建过程最终被中止。

【问题讨论】:

  • 看起来您可能使用了错误版本的 grunt。您在全球范围内安装了哪个版本的 grunt?如果它是 grunt 0.3.x,那么您将无法运行该 Gruntfile(它似乎是 grunt-0.4.x Gruntfile.js)。
  • @smithclay 是的,我运行的是 0.3.17。愚蠢的问题 - 我如何更新到最新的开发(0.4.x)? npm install grunt@0.4 似乎有效,但我得到 0.3 作为grunt --version的输出@

标签: jquery build gruntjs


【解决方案1】:

您需要运行最新的开发版本的 grunt,您可以通过 npm install grunt@master 获得它

还要确保您已卸载旧的全局 grunt npm uninstall -g grunt 并全局安装 grunt-cli npm install -g grunt-cli

Upgrading from 0.3 to 0.4

【讨论】:

  • 这不适用于构建我正在尝试做的 jQuery 1.9.0b1。至少,jQuery 1.9.0b1 有 grunt.js 文件而不是 Gruntfile.js 文件,因此显然是设计用于 grunt v0.3 而不是 0.4。 FWIW,我也不能用 grunt 0.4 构建 jQuery 2.0.0b1,但这是一个单独的问题。
猜你喜欢
  • 2015-08-18
  • 2014-08-17
  • 2017-12-01
  • 2017-06-02
  • 1970-01-01
  • 2020-01-10
  • 1970-01-01
  • 1970-01-01
  • 2021-08-06
相关资源
最近更新 更多