0
votes

Is there any guide to manage to deploy.sh script in Azure Web App on Linux for nodejs app? I am consistently getting deployment errors on running the command on the continuous deployment. The error starts with the 1st deployment script when I first setup the continuous deployment. The error mostly happened at "bower install" command where bower command is not found with bash command line.

To overcome this issue, I performed the following:

  1. Login to Kudu tool, Bash (ssh is not working on the 1st time)
  2. Run "npm install --production", but this will not complete the installation
  3. Run "bower install", getting error bower not install - tried with npm install -g bower - it's still not solving the problem.
  4. somehow, I tried several times to open/close Kudu tool, until SSH starts to load(miracle)
  5. with SSH terminal, I am able to perform "npm install -g bower" and "bower install", which concluded the installation and I'm able to load my website

However, the status of the deployment will still stay failed and subsequence deployment does not seem to have been improved at all as it failed at the deployment script.

The following is the error generated from subsequence deployment:

Command: "/home/site/deployments/tools/deploy.sh" /opt/Kudu/bin/Scripts/starter.sh: /home/site/deployments/tools/deploy.sh: /bin/bash^M: bad interpreter: No such file or directory /opt/Kudu/bin/Scripts/starter.sh: line 2: /home/site/deployments/tools/deploy.sh: Success /opt/Kudu/bin/Scripts/starter.sh: /home/site/deployments/tools/deploy.sh: /bin/bash^M: bad interpreter: No such file or directory\n/opt/Kudu/bin/Scripts/starter.sh: line 2: /home/site/deployments/tools/deploy.sh: Success\n/opt/Kudu/bin/Scripts/starter.sh "/home/site/deployments/tools/deploy.sh"

Hope experts from MS can help me on this matter. Thank you.

Best regards, Szelee

1
Is this a custom deployment script? The "/bin/bash^M: bad interpreter" error usually indicates that the script file has Windows line endings, which bash will fail on. If you want to share your app name (privately if you like: github.com/projectkudu/kudu/wiki/…), I can investigate a bit further.nlawalker
I'm using the deployment script from the server. I tested with new server setup too. You can check it at vivamobile.azurewebsites.netSzeLee Lai
On the site that's experiencing this error output, it looks like the deployment script was edited with something that changed the line endings. Try using the Kudu console to delete the contents of /home/site/deployments/tools and try triggering the deployment again. This will clear out the cached deployment script and cause it to be regenerated.nlawalker

1 Answers

0
votes

On Linux, it's important that any bash deployment scripts that get run have Unix line endings (LF) and not Windows line endings (CRLF). Kuduscript will generate scripts with platform-appropriate line endings, but if those scripts are modified, or if you provide your own custom deployment scripts, it's important to make sure that your editor doesn't change the line endings.

If something seems off with your deployment script, you can always use the Kudu console to delete the contents of /home/site/deployments/tools. This is the directory where Kudu caches kuduscript-generated deployment scripts. On the next deployment, the script will be regenerated.