grunt-bower-task throws"警告:找不到模块' bower'使用--force继续。"

时间:2015-11-02 03:12:22

标签: node.js gruntjs bower

执行<div id="board"></div>时,grunt会抛出以下错误

grunt bower:install

我尝试了kaushiks-MacBook-Pro:ama ghost$ grunt bower:install Running "bower:install" (bower) task Warning: Cannot find module 'bower' Use --force to continue. Aborted due to warnings. kaushiks-MacBook-Pro:ama ghost$ 但仍然无法工作。请帮忙。

1 个答案:

答案 0 :(得分:1)

您可能需要Bower作为本地依赖而非全局。如果您正在使用grunt-bower-task,那么您应该已经从其依赖项中下载了Bower - 但由于错误明确指出它无法找到模块bower,您应该在项目的根目录中使用{{1}将其安装在本地}。

npm install bower -D选项是-D的简写,--save-dev仅在NODE_ENV环境变量为development的情况下安装依赖项,默认情况下为{<1}}。