咕噜未能在Azure网站上运行 [英] Grunt fails to run on Azure Web Site

查看:140
本文介绍了咕噜未能在Azure网站上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图建立和使用的Azure的部署Git的包我的项目。

I'm trying to build and package my project using Azure's Git deployment.

我创建下列文件


  • .deployment

  • deploy.cmd

  • Gruntfile.js

  • 的package.json

  • .deployment
  • deploy.cmd
  • Gruntfile.js
  • package.json

我的 .deployment 文件调用 deploy.cmd deploy.cmd 通过设置路径,包括在的Node.js和NPM的副本检查设置环境。我可以叫 NPM安装就好了。当我打电话咕噜,似乎要执行到的第一个标准出来的消息,则返回和错误返回code设置。我没有得到比其他任何消息。其他命令似乎运行得很好。

My .deployment file calls deploy.cmd. deploy.cmd sets up the environment by setting the path to include a checked in copy of Node.js and npm. I can call npm install just fine. When I call grunt, it seems to execute up to the first standard out message, then it returns and the error return code is set. I don't get any other message than that. Other commands seem to run just fine.

我试着管道出了错误,都没有运气。我试过远程执行控制台下运行,没有运气。我的 Gruntfile.js 运行在本地就好了。

I've tried piping out the STDERR, no luck. I tried running under the Remote Execution console, no luck there. My Gruntfile.js runs locally just fine.

有一些神奇的调料,我很想念?

Is there some magic sauce that I am missing?

推荐答案

这是有点老了,但我会回答它无论如何,以防万一有人遇到这个问题。

This is a bit old, but I will answer it anyway just in case someone comes across this question.

首先,它是有帮助的,以便在禁用颜色咕噜,作为诊断控制台和部署日志都与ANSI codeS斗争。要做到这一点,运行咕噜--no色。这应该得到STDOUT信息返回到控制台,进入部署日志。

First, it is helpful to run grunt with colors disabled, as both the diagnostic console and the deployment logs struggle with the ANSI codes. To do this, run grunt --no-color. This should get the STDOUT information back into the Console and into the Deploy log.

二,我不建议使用签入节点或NPM的版本。 Windows Azure中已经具备了这些建设环境,并已被配置为达到最佳执行需要两个特别临时路径和高速缓存路径。

Second, I do not recommend using checked-in versions of Node or NPM. Windows Azure already has these build in to the environment, and already is configured for the special temporary paths and cache paths needed for both to execute at their best.

项目捻是部署引擎Azure的部署提供动力,但你已经知道这一点,因为你有一个.deployment文件。然而,在Azure命令行工具[ NPM安装Azure的CLI --global ]将帮助你脚手架一些将使用Azure中的pre-安装节点更好的部署脚本和NPM设置。

Project Kudu is the deployment engine powering Azure Deployments, but you already know this, since you have a .deployment file. However, the Azure Command Line Tools [npm install azure-cli --global] will help you scaffold out some better deployment scripts that will use Azure's pre-installed Node and NPM setup.

azure site deploymentscript –-node

将让你的基节点脚本。

will get you that base node script.

从那里,进行一些修改是需要 deploy.sh 来得到它来执行咕噜,可靠。在 deploy.sh 是一个#Deployment部分。替换为以下内容:

From there, a few modifications are needed to deploy.sh to get it to execute Grunt, reliably. Within deploy.sh is a #Deployment section. Replace its contents with the following:

# Deployment
# ----------

echo Handling node.js grunt deployment.

# 1. Select node version
selectNodeVersion

# 2. Install npm packages
if [ -e "$DEPLOYMENT_SOURCE/package.json" ]; then
  eval $NPM_CMD install
  exitWithMessageOnError "npm failed"
fi

# 3. Install bower packages
if [ -e "$DEPLOYMENT_SOURCE/bower.json" ]; then
  eval $NPM_CMD install bower
  exitWithMessageOnError "installing bower failed"
  ./node_modules/.bin/bower install
  exitWithMessageOnError "bower failed"
fi

# 4. Run grunt
if [ -e "$DEPLOYMENT_SOURCE/Gruntfile.js" ]; then
  eval $NPM_CMD install grunt-cli
  exitWithMessageOnError "installing grunt failed"
  ./node_modules/.bin/grunt --no-color clean common dist
  exitWithMessageOnError "grunt failed"
fi

# 5. KuduSync to Target
"$KUDU_SYNC_CMD" -v 500 -f "$DEPLOYMENT_SOURCE/dist" -t "$DEPLOYMENT_TARGET" -n "$NEXT_MANIFEST_PATH" -p "$PREVIOUS_MANIFEST_PATH" -i ".git;.hg;.deployment;deploy.sh"
exitWithMessageOnError "Kudu Sync to Target failed"

这将运行 NPM安装,后跟亭子安装(如果存在bower.json),其次是咕噜干净共同DIST (如果存在Gruntfile.js),最后一个KuduSync到 / wwwroot文件。 (注意:你需要运行任何咕噜任务取代干净共同DIST')

This will run npm install, followed by bower install (if bower.json exists), followed by grunt clean common dist (if Gruntfile.js exists), and finally a KuduSync into your /wwwroot. (Note: replace 'clean common dist' with whatever Grunt tasks you need to run.)

有可能运行几个其他问题。我在一个张贴在我的个人博客,其中包括一些你可能会碰到的问题。

There are a few other issues you may run in to. I write this up in a post on my personal blog, which includes some of the issues you may run into.

这篇关于咕噜未能在Azure网站上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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