简体   繁体   中英

unable to install npm keepagentalive and npm version 7 in azure function console (app service editor)

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?

\\> 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 npm@7.20.3 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

在此处输入图片说明

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:

在此处输入图片说明

在此处输入图片说明

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.* .

在此处输入图片说明

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM