Home > Software design >  unable to install npm keepagentalive and npm version 7 in azure function console (app service editor
unable to install npm keepagentalive and npm version 7 in azure function console (app service editor

Time:11-16

I have tried the following commands to install the my required version of npm on azure function app - app service editor but not worked.

To Reproduce: I have created function app(.NET) in visual studio locally in windows and deployed to Azure Function App (Stack - .NET 3.1 LTS) Azure portal > My Resource group > Function App > App service Editor (under Development Tools in left index pane) > select Console option

App service editor preview

The commands I have tried is:

\> npm -v
2.15.11
\> npm install -g agentkeepalive --save
npm WARN engine agentkeepalive@4.1.4: wanted: {"node":">= 8.0.0"} (current: {"node":"4.8.4","npm":"2.15.11"})
npm WARN engine debug@4.3.2: wanted: {"node":">=6.0"} (current: {"node":"4.8.4","npm":"2.15.11"})
agentkeepalive@4.1.4 C:\home\data\monaco\home\npm\node_modules\agentkeepalive
├── depd@1.1.2
├── humanize-ms@1.2.1 (ms@2.1.3)
└── debug@4.3.2 (ms@2.1.2)
\> npm install -g npm@7.20.3
npm WARN engine npm@7.20.3: wanted: {"node":">=10"} (current: {"node":"4.8.4","npm":"2.15.11"})
C:\home\data\monaco\home\npm\npm -> C:\home\data\monaco\home\npm\node_modules\npm\bin\npm-cli.js
C:\home\data\monaco\home\npm\npx -> C:\home\data\monaco\home\npm\node_modules\npm\bin\npx-cli.js
npm@7.20.3 C:\home\data\monaco\home\npm\node_modules\npm
\> npm -v
2.15.11
\> 

Could any help me how to install keepagentalive and install the latest npm version in azure function - app service editor?

CodePudding user response:

\> npm install -g agentkeepalive --save
npm WARN engine agentkeepalive@4.1.4: wanted: {"node":">= 8.0.0"} (current: {"node":"4.8.4","npm":"2.15.11"})

As you can see in this line it is failing because it has node version below than required same in npm install -g [email protected] too it needs more than {"node":">= 8.0.0"}.

For doing that you need to update few settings from configuration > settings tab from left pane. Below are the settings :

Name : `WEBSITE_NODE_DEFAULT_VERSION`
Value : 14.15.0

Name : `WEBSITE_RUN_FROM_PACKAGE`
Value : 0 [If published functions already]

Name : `FUNCTIONS_EXTENSION_VERSION`
Value : beta [optional]

After setting to above required parameters you can go to console and Add try npm -v

enter image description here

If you want to update it to the latest version then try npm install -g npm@latest or npm install -g npm@<Your required version>. We have tried to update npm in our environment. Here are the screenshots for your reference:

enter image description here

enter image description here

While in App Service Editor the latest version will be 6.14.* because in app services the latest node version is 14v and the node.js 14 LTS npm latest version is 6.14.*. So though you try installing the latest version the npm still remains 6.14.*.

enter image description here

REFERENCES :

  1. Azure Functions Support for node.JS 14 and .Net 5 Is Generally Available.
  2. Node.js version 12.14.x be available on Azure App Services.
  • Related