Bower Install Error In Azure App Services - node.js

I was running my bower package manager in Azure App Services. When I ran the following command:
bower install
or even
bower install --force
Any ideas how to overcome this?
Thanks.

You can custom the deployment task to achieve your requirements.
Generally speaking, you can try the following steps,
install azure x-platform command via npm install azure-cli -g
run custom deployment script generator via azure site deploymentscript --node
This command will create 2 files named .deployment and deploy.cmd
In deploy.cmd file include below lines of code after installing npm packages. Change bower install folder based on your requirement.
IF EXIST "%DEPLOYMENT_TARGET%\public\bower.json" (
pushd "%DEPLOYMENT_TARGET%\public"
call ..\node_modules\.bin\bower install
IF !ERRORLEVEL! NEQ 0 goto error
popd
)
Then next you deploy your application to Azure via Git, it will run the deployment script which will run bower install script in your application.
You can refer to https://blogs.msdn.microsoft.com/azureossds/2016/01/25/using-bower-in-node-js-azure-webapps/ for more detailed info. And here is a sample on Github about bower sample on Azure.

Related

Npx fails on Azure App Service deployment

I'm trying to deploy a Node.js (Remix) application to an Azure App Service instance. After installing the npm packages, the post-install script must run for the Remix app to eventually work. The post-install script is npx remix setup node.
Unfortunately, the deployment fails because of the following reason:
npm ERR! could not determine executable to run
I get the same error when trying to use other npx commands, as npx prisma generate. I tried npm exec as well instead of npx.
Thank you in advance!
In startup command try using npx serve -s build/
Also, under your app service Settings blade check all the general settings.
Make sure that your web.config was published along with your app.

Deploying Angular app to NodeJS using Azure Devops

Is there a way to automate deployment of Angular application to NodeJS or onPrem WebServer using Azure Devops PipeLines.
For Angular apps, you can include Angular-specific commands such as ng test, ng build, and ng e2e. To use Angular CLI commands in your pipeline, you need to install the angular/cli npm package on the build agent.
- script: |
npm install -g #angular/cli
npm install
ng build --prod
Note:
On Microsoft-hosted Linux agents, preface the command with sudo,
like sudo npm install -g.
https://learn.microsoft.com/en-us/azure/devops/pipelines/ecosystems/javascript?view=azure-devops&tabs=example#angular

How can I upgrade yarn on Azure Web Service and make yarn workspaces work

I cannot make yarn workspaces work on Azure Web Service and I cannot upgrade yarn.
I have an application deployed as Azure Web Service. It uses yarn workspaces. Unfortunately during yarn install the error occurs
[3/4] Linking dependencies...
error An unexpected error occurred: "ENOENT: no such file or directory, lstat '/home/site/wwwroot/node_modules/#gsx/common'".
info If you think this is a bug, please open a bug report with the information provided in "/home/site/wwwroot/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
I read that upgrading the yarn can solve the problem. Azure by default comes with yarn 1.6.0.
I have deploy.sh file in my repository, so I can customize the deployment process. I would like to add command to upgrade yarn.
I tried to achieve it in two ways:
npm install -g yarn
and
sudo npm install -g yarn
Both of them fails. In the first situation I get a message that I do not have enough permissions. In the second one the logs say that there is no command sudo.
Do you have an idea, how can I upgrade yarn?
Please take a look at this repo and give it a try. All you'd have to do is copy the deploy.cmd and .deployment files from the above repo to yours, which would make Kudu use this script instead of the default one. Hope this helps.

Unable to install "testmybot" npm package

I am trying to use this sample to demonstrate the chatbot testing using node "testmybot" package. When I execute "npm install" command I am getting error. Please find the screenshot of the same attached below.
Steps that I have followed:
1. Downloaded the project from [https://github.com/codeforequity-at/testmybot-sample-calculator]
2. Extracted the project to "testmybot-sample-calculator-master" folder
3. Inside the folder executed "npm install" command
4. After installing some packages, looks like while installing botkit package it is throwing error
Please let me know if I have missed out any steps.
To run this sample, there is now a Dockerfile included in the Github repository. The following commands should retrieve the latest files from Github, build a docker container and running the sample test cases inside.
$ git pull
$ docker build -t testmybot-sample-calculator .
$ docker run testmybot-sample-calculator
Obviously, you have to install docker first.
UPDATE:
I was able to reproduce it on a Windows workstation, user had no admin rights. Found solution here: you have to install the windows-build-tools package first, with a user having admin rights:
npm install --global --production windows-build-tools
Afterwards, installation of the package in question was possible.

Continuous integration and deployment of Node.js application on Bamboo

The application I want to implement continuous deployment on Bamboo has node modules and bower component dependencies. On the bamboo server nodejs, npm have been installed.
There are only three tasks on default job:
Source Code Checkout
Build dependencies:
npm install
bower install
Deploy to the staging server
The problem is on the second task, bamboo fails with the message "No failed tests found, a possible compilation error occurred." I don't even run any tests.
The log file is not explanatory at all:
Starting task 'Build dependencies' of type 'com.atlassian.bamboo.plugins.scripttask:task.builder.script'
Failing task since return code of [/bin/sh /home/ubuntu/bamboo-installation/temp/WEB-WEB-JOB1-8-ScriptBuildTask-4430338079602360707.sh] was 1 while expected 0
Ok, I solved the problem. The issue was the wrong node (which obviously messed things up) was installed on the bamboo server. Uninstalled the wrong one and everything worked as expected.
Good to see you solved it.
There is a setup I use and which could prevent further problems with CI:
export npm_config_prefix=.npm/
export PATH=.npm/bin:$PATH
export CI=true
npm install -g bower
bower install
npm install
This installs bower (and others like grunt-cli if you want) in your project folder so you can e.g. have a specific version, sets CI=true as advised in bower docs, and then installs all dependencies.
Bamboo AMI originally have npm version 1.4.28 installed and you are probably using a more recent version on you development environment. I had the same issue and resolved it by creating a script task to update npm version on the very beginning of my build process. Here is the script:
# update npm
curl -O -L https://npmjs.org/install.sh
chmod +x install.sh
sudo PATH=$PATH:/opt/node-0.10/bin ./install.sh

Resources