- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我有一个 Node/Angular 项目,它使用 npm 进行后端依赖管理,使用 bower 进行前端依赖管理。我想使用 grunt 任务来执行这两个安装命令。我一直不知道该怎么做。
我尝试使用 exec
,但它实际上并没有安装任何东西。
module.exports = function(grunt) {
grunt.registerTask('install', 'install the backend and frontend dependencies', function() {
// adapted from http://www.dzone.com/snippets/execute-unix-command-nodejs
var exec = require('child_process').exec,
sys = require('sys');
function puts(error, stdout, stderr) { console.log(stdout); sys.puts(stdout) }
// assuming this command is run from the root of the repo
exec('bower install', {cwd: './frontend'}, puts);
});
};
当我 cd
进入前端时,打开 node
,并从控制台运行此代码,这工作正常。我在 grunt 任务中做错了什么?
(我也尝试使用 bower 和 npm API,但也无法使用。)
最佳答案
要在 npm install
期间安装客户端组件,同时安装服务器端库,您可以添加 package.json
"dependencies": {
...
"bower" : ""
},
"scripts": {
...
"postinstall" : "bower install"
}
我更喜欢区分安装和测试/构建
关于javascript - 使用 grunt 自动化 npm 和 bower 安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14166591/
我刚刚升级到Bower 1.0,做了一个bower install,发现了一堆新的.bower.json文件(注意前导时期)。 我在changelog或文档中没有找到对.bower.json的引用。我
Bower 的网站描述了 Bower.json 中的 ignore 键: ignore [array]: An array of paths not needed in production that
我已经在我的项目根目录中添加了一个 bower 包。我正在使用 bower,因此可以更轻松地管理每个组件的更新(bower 的功能之一)。但是我在安装后收到了这条消息: no-json No bowe
当我通过以下方式从 git repo 安装库时: bower install git@github.com:fabiantheblind/p5.js.git --save 该组件被克隆到我的 bowe
我已经为 Bower 设置了一个 Nexus 代理注册表。我正在使用 Debian 9。bower 版本是 1.8.8,安装了 bower-nexus3-resolver(版本 1.0.4)。我的 .
是否可能只有一个可以从 Bower“安装”的存储库? 目前我已经注册了一个连接到开发库的 bower 包,但是在运行时 bower install我只想要 dist要下载的文件。 我见过有人保留两个存
我正在尝试安装 https://github.com/aterrien/jQuery-Knob通过 bower 。在包的 bower.json 文件中,我看到: { "name": "aterrien
我正在尝试通过 bower 安装本地 Jquery ui。 我有一个名为 jquery-ui 的本地文件夹并运行了以下命令 bower install jquery-ui/jquery-ui.min.
我正在研究如何使用 bower 安装软件包。 当我 'bower install packagename' 时,软件包安装在/app/components/中。 但是,我想自己决定项目的结构。 有没有
$ bower install angular-animate --save bower cached git://github.com/angular/bower-angular-animate.g
我正在使用 bower 从下面的 bower.json 中查看依赖项,所以问题是我希望 bower 提供更新版本发布的依赖项报告但不安装它,对于使用 npm-check-updates for npm
一些库在其 Github 存储库中没有已经构建的 JavaScript 文件,因为这些库的作者反对保留构建工件(例如 Sinon.JS)。是否有使用 Bower 处理此问题的首选方法? 我知道我可以
我想运行我自己的 bower 服务器来开始跨团队共享几个内部模块。我很难找到运行您自己的服务器的信息。在 bower.io 网站上有这条线 N.B. To run your own Bower End
在 *nix 上,bower 使用 ~/.bower其缓存的文件夹(包等)。 我想将其更改为其他位置。 bower spec来自的文档建议我配置 storage输入我的.bowerrc . 我在我的项
我有一个项目依赖于另一个使用 Bower 的项目。我要 bower install当我在父项目上运行它时也运行在该组件上。到目前为止,我还没有在 configuration spec 中找到任何东西,
如何在不提供 bower.json 中的用户凭据的情况下将访问受限存储库作为依赖项添加到 bower.json? 即我想避免像这样指定它: { "dependencies": { "ang
Bower 文档说 N.B. If you aren't authoring a package that is intended to be consumed by others (e.g., yo
我正在下载 Angular、Angular-Bootstrap 和 Bootstrap with Bower。 Bootstrap 依赖于进程中安装的 jquery。但我的项目中不需要它,因为我只使用
我正在尝试为使用 Bower 的应用程序设置自动包构建。 postinstall中进入bower install时,bower提示: [?] May bower anonymously report
我想将特定分支的最新版本指定为依赖项。具体来说,我想在 Bootstrap v3.0 发布之前使用它。 将其指定为 Bower 中的依赖项的最佳方法是什么? 最佳答案 您需要使用#、appended
我是一名优秀的程序员,十分优秀!