Azure-App-Service / kudu

Apache License 2.0
10 stars 13 forks source link

"Selected npm version null" or similar during node deployment #30

Open nickwalkmsft opened 7 years ago

nickwalkmsft commented 7 years ago

Kudu's selectNodeVersion.js doesn't correctly handle values of WEBSITE_NODE_DEFAULT_VERSION calculated from linuxFxVersion.

A fix will be rolled out soon. In the meantime (and generally), the recommendation to customers is to set engines.node in package.json to a major.minor version. This will ensure usage of the newest point release of the desired major.minor.

prashanthmadi commented 6 years ago

@nickwalkmsft

unfortunately, selecting nodejs version during git deployment from package.json doesn't work as expected.. so i came up with below script.. https://github.com/prashanthmadi/ng-azure-webapp-linux/blob/master/deploy.sh

Important thing here is the second point.. there is no way to change nodejs version in kudu cli and this would cause some issues as below..

Try deploying below app as part of github deployment https://github.com/prashanthmadi/ng-azure-webapp-linux

and you might experience below error..

You are running version v6.11.0 of Node.js, which is not supported by Angular CLI v6.
The official Node.js version that is supported is 8.9 and greater.
An error has occurred during web site deployment.

react build failed
Please visit https://nodejs.org/en/ to find instructions on how to update Node.js.
npm ERR! code ELIFECYCLE
npm ERR! errno 3
npm ERR! lptest-angular@0.0.0 build: `ng build`
npm ERR! Exit status 3
npm ERR! 
npm ERR! Failed at the lptest-angular@0.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/.npm/_logs/2018-05-18T17_21_17_609Z-debug.log
npm WARN notice [SECURITY] ws has 1 high vulnerability. Go here for more details: https://nodesecurity.io/advisories?search=ws&version=1.1.2 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.\nnpm WARN notice [SECURITY] stringstream has 1 moderate vulnerability. Go here for more details: https://nodesecurity.io/advisories?search=stringstream&version=0.0.6 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.\nnpm WARN notice [SECURITY] debug has 1 low vulnerability. Go here for more details: https://nodesecurity.io/advisories?search=debug&version=2.3.3 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.\nnpm WARN notice [SECURITY] debug has 1 low vulnerability. Go here for more details: https://nodesecurity.io/advisories?search=debug&version=2.2.0 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.\nnpm WARN notice [SECURITY] parsejson has 1 high vulnerability. Go here for more details: https://nodesecurity.io/advisories?search=parsejson&version=0.0.3 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.\nnpm WARN notice [SECURITY] tunnel-agent has 1 moderate vulnerability. Go here for more details: https://nodesecurity.io/advisories?search=tunnel-agent&version=0.4.3 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.\nnpm WARN notice [SECURITY] hoek has 1 moderate vulnerability. Go here for more details: https://nodesecurity.io/advisories?search=hoek&version=2.16.3 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.\nnpm WARN notice [SECURITY] lodash has 1 low vulnerability. Go here for more details: https://nodesecurity.io/advisories?search=lodash&version=3.10.1 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.\nnpm WARN prefer global node-gyp@3.6.2 should be installed with -g\nYou are running version v6.11.0 of Node.js, which is not supported by Angular CLI v6.\nThe official Node.js version that is supported is 8.9 and greater.\n\nPlease visit https://nodejs.org/en/ to find instructions on how to update Node.js.\nnpm ERR! code ELIFECYCLE\nnpm ERR! errno 3\nnpm ERR! lptest-angular@0.0.0 build: `ng build`\nnpm ERR! Exit status 3\nnpm ERR! \nnpm ERR! Failed at the lptest-angular@0.0.0 build script.\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR!     /home/.npm/_logs/2018-05-18T17_21_17_609Z-debug.log\n/opt/Kudu/bin/Scripts/starter.sh bash deploy.sh

we need to make this line configurable via APP setting or set it to higher version > 9 https://github.com/Azure-App-Service/kudu/blob/master/kudu/Dockerfile#L161

ENV PATH $PATH:/opt/nodejs/6.11.0/bin
prashanthmadi commented 6 years ago

I have tried setting PATH manually from cli but unable to change it.. could be that we don't allow changing it..

/opt/nodejs>echo $PATH
/home/site/deployments/tools:/opt/Kudu/bin/Scripts:/usr/bin:/usr/bin:::Microsoft SDKs/F#/3.1/Framework/v4.0:/usr/bin:/usr/share/npm:/usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/local/go/bin:/usr/local/.rbenv/bin:/usr/local:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/nodejs/6.11.0/bin

/opt/nodejs>set PATH=$PATH:/opt/nodejs/9.4.0/bin

/opt/nodejs>echo $PATH
/home/site/deployments/tools:/opt/Kudu/bin/Scripts:/usr/bin:/usr/bin:::Microsoft SDKs/F#/3.1/Framework/v4.0:/usr/bin:/usr/share/npm:/usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/local/go/bin:/usr/local/.rbenv/bin:/usr/local:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/nodejs/6.11.0/bin

/opt/nodejs>node -v
v6.11.0

Update: setting it from script might work.. will work on it and update