Azure Git Deployment Failing - Selectnodeversion.js - node.js

I am having trouble deploying to azure through my git hosted on Azure, the build through JenkinsCI will pass fine but once it tries to deploy Azure throws this;
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling node.js deployment.
KuduSync.NET from: 'D:\home\site\repository' to: 'D:\home\site\wwwroot'
An error has occurred during web site deployment.
undefined:5
<<<<<<< HEAD
^
SyntaxError: Unexpected token <
at Object.parse (native)
at Object.<anonymous> (D:\Program Files (x86)\SiteExtensions\Kudu\28.30730.1063\bin\scripts\selectNodeVersion.js:119:44)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
Any help is really appreciated, Thanks!

This sounds like a possible Kudu issue (the git deployment engine in Azure). It would be best if you can open an issue on https://github.com/projectkudu/kudu so we can investigate.
Please include additional details about your repo. If you are able to share a small repo that demonstrates the problem, it would be ideal. Thanks!

Related

Issues with Sharp in Azure functions

Hi I have been trying to deploy my code for resizing image streams in azure function.
It seems to be working perfectly fine in local, even deployment via VS code is successful.
But when I try to trigger the function, I get below exception.
Relatively new to both nodejs and azure, any suggestions?
2021-06-08T04:51:24.370 [Information] Executing 'Functions.HttpTrigger1' (Reason='This function was programmatically called via the host APIs.', Id=7bd3aba0-8833-4ffe-b2c7-a061533fef6a)
2021-06-08T04:51:24.444 [Error] Executed 'Functions.HttpTrigger1' (Failed, Id=7bd3aba0-8833-4ffe-b2c7-a061533fef6a, Duration=17ms)
Result: Failure
Exception: Worker was unable to load function HttpTrigger1: 'Error: 'win32-x64' binaries cannot be used on the 'win32-ia32' platform. Please remove the 'node_modules/sharp' directory and run 'npm install' on the 'win32-ia32' platform.'
Stack: Error: 'win32-x64' binaries cannot be used on the 'win32-ia32' platform. Please remove the 'node_modules/sharp' directory and run 'npm install' on the 'win32-ia32' platform.
at Object.hasVendoredLibvips (C:\home\site\wwwroot\node_modules\sharp\lib\libvips.js:82:13)
at Object.<anonymous> (C:\home\site\wwwroot\node_modules\sharp\lib\constructor.js:7:22)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\home\site\wwwroot\node_modules\sharp\lib\index.js:3:15)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
According to the error message, we need to update Azure function as 64 bit Platform. Regarding how to do that, please refer to here.

Google Cloud Function not recognizing Papaparse 5.0 Dependency

I am building a Node.js Google Cloud function, and it is not recognizing the dependency "papaparse":
in package.json
"dependencies": {
"papaparse": "^5.0.0",
"twilio": "^3.33.2"
}
Error code I am getting:
Function failed on loading user code. Error message: Code in file index.js can't be loaded.
Did you list all required modules in the package.json dependencies?
Detailed stack trace: Error: Cannot find module 'papaparse'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/srv/index.js:8:14)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
I have tried reinstalling papaparse, running npm audit, but those steps haven't helped.
Does anyone know why this would happen?
I just managed to deploy a Cloud Function with papaparse.
For this you just need to deploy your function from the Cloud Shell. First create a folder where you gonna insert all your files. Then clone the repo from the papaparse github with the command git clone into that folder.
Now after adding your Index.json and your Package.json you can deploy your Cloud Function following this Deploying from Your Local Machine documentation.

Can't run node project after formatting my linux partition

As the title says, I formatted my linux partition where I used as web development environment. Mainly I used MongoDB and NodeJS and both of them are installed correctly. But when I try to execute my main.js I get an error log. It must be something extremely silly that I'm not reminded of. Any help is appreciated. Error log:
SyntaxError: Invalid or unexpected token
at new Script (vm.js:74:7)
at createScript (vm.js:246:10)
at Object.runInThisContext (vm.js:298:10)
at Module._compile (internal/modules/cjs/loader.js:657:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
Note that helpers.js is a node internal module.
Please download nodeJS command prompt for Linux or download by command
pacman -S nodejs npm
For More help : Visit the link
Node JS Installation Guide

(update solution)Express web app service is throwing "SyntaxError: Unexpected token >"

I deployed the same web app to two Azure app services, one the fine, while another is throwing such an error. My web is based on Express, how could I fix this issue? Looks the error is not from my source code.
Fri Jul 27 2018 20:05:22 GMT+0000 (Coordinated Universal Time): Application has thrown an uncaught exception and is terminated:
SyntaxError: Unexpected token >
at Module._compile (module.js:434:25)
at Object..js (module.js:464:10)
at Module.load (module.js:353:31)
at Function._load (module.js:311:12)
at Module.require (module.js:359:17)
at require (module.js:375:17)
at Object.<anonymous> (D:\Program Files\iisnode\interceptor.js:459:1)
at Module._compile (module.js:446:26)
at Object..js (module.js:464:10)
at Module.load (module.js:353:31)
I came across this issue when I set WEBSITE_NODE_DEFAULT_VERSION to a version that was not compatible with Azure.
It fell back to a really old version of node that does not support arrow functions.
You can verify this by going to the Azure Console and doing node -v
This issue was fixed finally, we raised a ticket to MS, Microsoft redeployed the app service to a new set of servers.Then the web site works.

How to use node-oracle with iisnode?

I'm having trouble trying to run a Node.js server with node-oracle via iisnode. The iisnode examples all work, and running the server [on a different port] in a Command Window works perfectly. The server setup is based upon "The Node Beginner Book" example (i.e. index.njs -> server.njs -> router.njs -> requesthandlers.njs). I renamed all of my node files as *.njs and currently have my web.config set up for iisnode to handle all files of that extension, with a rewrite rule to forward the incoming requests to index.njs. The problem occurs when node-oracle -- utilized within requesthandlers.njs -- attempts to call oracle_bindings.node:
Application has thrown an uncaught exception and is terminated:
Error: The specified module could not be found.
c:\Program Files\iisnode\www\Reports\node_modules\oracle\build\Release\oracle_bindings.node
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (c:\Program Files\iisnode\www\Reports\node_modules\oracle\lib\oracle.njs:2:16)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
I've given read/write/execute permissions to the IIS_IUSRS group on every folder imaginable within the .\iisnode\www\Reports\node_modules\oracle path. I've also attempted the solution in Node cannot find modules in IIS, can find from prompt to no avail. While I could probably just set the server up as a service, I'd prefer to have it through IIS so that I don't have to battle with CORS while supporting IE9. Any help is greatly appreciated, thanks!

Resources