AWS Elastic Beanstalk运行Grunt任务 [英] AWS Elastic Beanstalk run Grunt task

查看:131
本文介绍了AWS Elastic Beanstalk运行Grunt任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在弹性beanstalk上运行一个node.js应用程序。我有一个客户端,通过一个咕噜的工作(玉,少,concat等)来构建我从git中排除这个文件夹



我可以通过 grunt buildClient grunt-cli

执行

我添加了 grunt grunt-cli 在我的包中 dev-dependencies



我想在应用程序启动之前运行grunt构建,我已经在 .ebextensions / app.config
$ $ p $ $ code $ container_commands:
01_build_client
命令:grunt buildClient

我想我的cwd是 / tmp / deployment / application /



但有说<致命错误:无法找到本地grunt 。我猜grunt-cli已经安装了,但是为什么会出现这个错误呢?

我也尝试将grunt作业放在 postinstall package.json 的部分,但这也不起作用。



如何构建我的咕噜作业在EBS实例上?

解决方案

在paas上运行Grunt时,最好安装grunt-cli和grunt的本地副本在本地项目中。这样它总是可用的,并且是你需要的确切版本。然后你运行 npm install 而不是 grunt ,这样你的 postinstall

例如,您的 package.json 可能如下所示:

 grunt:0.4.5,
grunt-cli:0.1.13,


I want to run a node.js application on elastic beanstalk. I have a client which gets build by a grunt job (jade, less, concat, etc.) I excluded this folder from git

I can localy run this by grunt buildClient which is executed by grunt-cli

I added grunt and grunt-cli in my packages dev-dependencies

I want to run the grunt build before the application is launched, i already setup a configuration in .ebextensions/app.config

container_commands:
  01_build_client:
    command: grunt buildClient

I guess my cwd is /tmp/deployment/application/

but there is says Fatal error: Unable to find local grunt. I guess grunt-cli is installed, but why is this error?

i also tried putting the grunt job in the postinstall section of package.json, but this doesnt work as well.

How do i build my grunt job on a EBS instance?

解决方案

When running Grunt on a paas, it's best to install a local copy of grunt-cli and grunt locally in the project. That way it's always available and is the exact version you'll need. Then you run npm install instead of grunt so your postinstall works properly.

For example, your package.json might look like this:

"grunt": "0.4.5",
"grunt-cli": "0.1.13",

这篇关于AWS Elastic Beanstalk运行Grunt任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆