Azure App Service not installing all node dependencies - node.js

I have a nodejs azure app service. It seems like npm isn't installing all the dependencies correctly. The site runs locally fine, when i try in azure, I get 500 responses.
When I check the log, it shows various node dependencies missing. After I install the missing one using the console on the portal, another missing dependency notification pops up.
Using git deploy, I've tried just committing the entire node_modules folder, but for some reason, all the bits don't get uploaded.
Grateful for any ideas about how to sort this out.

Related

Heroku Deployment failing to see Angular components

I tried to deploy my Angular application trough my gitlab pipeline to heroku. But when i check the logs it seems to error on alot of angular components/modules. This is weird because it doesn't show any errors when i try to build the application local.
Here's the link for the console error:
https://pastebin.com/LnncztUu
gitlab logging
I already tried deleting the node_modules folder and reinstalling it but to my suprise it didn't work. And i compiled my angular application in production mode and i found no errors also.
Are you positive the missing components are fully under source control and were added to the repository. Seems like the components in your own project are missing src/app/Shared/Services/Product.service Not found.

How to deploy an edited node module package(local) to heroku without losing the changes?

So, I have a situation where I needed to edit a node module package I'm using in my node app. Now, on deploying the app to heroku the changes are getting lost because it is getting that package from npm.
Please suggest a way other than publishing my own version of that package to npm.
I don't think you can :/
I have a bot deployed there and every time I wanna deploy some new changes everything gets lost. Probably you should check some external packages installed by Heroku.

Azure Web App unexpected "Bad Request"

I'm occasionally getting "Bad Request" in the Azure Console (located in the main 'blade' of the Azure web app). One example is when running npm install grunt-sass but there were several other times with different commands, all of which are valid commands that should execute immediately with no errors.
I think this is a bug in Azure. I haven't seen the problem when using the Kudu Diagnostic Console.
Why is this happening?
On my side, it looks like depends on the npm version in the Azure Web Apps sanbox. I upgrade the npm version to 4.2.0, and successfully installed grunt-sass both via Kudu Conosole, or App Service Editor's Console Tool.
Please navigate to Application settings blade of your Azure Web Apps, and add the WEBSITE_NPM_DEFAULT_VERSION configuration in App settings section:
Then, it should work as expected.
In Kudu Console:
In App Service Editor:
At last, we recommend you can leverage custom deployment of Azure Web Apps, you can configure your dependencies in package.json, and deploy to Azure via Git, the deployment task will install the dependencies automatically, you can refer to Custom startup command for Node.js app on Azure with Babel 6 for the similar steps.
I found that if you're having a "Bad Request" error while running the npm install command in Azure App Service's Console, the npm process is still running in the background and it will complete.
That means that you should not try to run npm i again until it completes. You can monitor the progress via FTP - when the .staging folder in node_modules is empty, that means installation is complete.

Issue with Firebase deployment

Obviously I am missing something (!)obvious but I simply cannot deploy my app to firebase. I am following this google guide for progressive web apps. Web server didn't work for me ( to access my app from other devices ), so I tried using firebase as was suggested in the end of the guide. I follow the directions, everything executes with no issues and all I get at the end is "Welcome to Firebase hosting" default message. I am using linux, here is what I did:
Installed firebase tools with "sudo npm install -g firebase-tools"
Went to project root directory and used "firebase init". I selected hosting, typed in "/" as public directory and chose the configure for single page option. Everything worked fine.
Typed "firebase deploy" and again everything completed with no errors. No result.
Tried adding manually all my project files (Firebase dashboard - Storage). Still nothing.
I also read their guide, but didn't find any steps I missed or failed. So what am I doing wrong here?
Thanks

NPM errors and control in Azure Websites

I want to build my Node.JS application in a Azure Website.
There will be an usage of different NPM packages via my packages.json file.
My problem is that I often receive error messages which are related to missing NPM files.
Normally I put my files via FTP or edit them per VS Studio 15 Azure plugin directly on the server. This may be the reason why NPM isn't triggering as Microsoft intended it.
I would prefer a way in which I can just run commands with elevated privileges to have full control over NPM by myself.
Which ways are possible to avaid these problems?
If you're publishing your nodeJS application 'manually' via FTP there are little concerns about that.
First of All, 'manually' means manually.
Git
If you use continuous deployment via Git the final deployment step is to call npm install in your current application folder, this will install all the packages listed in package.json file.
The node_modules folder is excluded by default in .gitignore file, so all packages are downloaded by the server
Web deployment
If you're using web deployment from visual studio or command line, all the files contained by your solution are copied to Hosting environment including node_modules folder , because of this the deployment would take a long time to finish due the huge amount of dependencies and files that the folder contains.
Even worst: this scenario could take you to the same scenario you're facing right now.
FTP deployment
You're copying everything yourself. So the same thing occurs in Web Deployment is happen in FTP deployment method.
--
The thing is that when you copy all those node_modules folder contents you're assuming that those dependencies remains the same in the target enviroment, most of the cases that's true, but not always.
Some dependencies are platform dependent so maybe in you're dev environment a dependency works ok in x86 architectures but what if your target machine or website (or some mix between them) is x64 (real case I already suffer it).
Other related issues could happen. May be your direct dependencies doesn't have the problem but the linked dependencies to them could have it.
So always is strongly recommended to run npm install in your target environment and avoid to copy the dependencies directly from your dev environment.
In that way you need to copy on your target environment the folder structure excluding node_modules folder. And then when files are copied you need to run npm install on the server.
To achieve that you could go to
yoursitename.scm.azurewebsites.net
There you can goto "Debug Console" Tab, then goto this directory D:\home\site\wwwroot> and run
npm install
After that the packages and dependencies are downloaded for the server/website architecture.
Hope this helps.
Azure tweak the Kudu output settings, in local Kudu implementations looks the output is normalized.
A workaround -non perfect- could be this
npm install --dd
Or even more detailed
npm install --ddd
The most related answer from Microsoft itself is this
Using Node.js Modules with Azure applications
Regarding control via a console with elevated privileges there is the way of using the Kudu console. But the error output is quite weird. It's kind of putting blindly commands in the console without much feedback.
Maybe this is a way to go. But I didn't tried this yet.
Regarding deployment it looks like that Azure wants you to prefer Continuous Deployment.
The suggested way is this here.

Resources