Ok I give up. Why does Azure have some default version of node (0.10.x for gawds sake) and then relies on using hard-coded paths for the specific version required? That wa
I had to
npm rebuild node-sass
before running the ng build --production
.
I found a note about this buried in the error message. I originally dismissed this as the npm install
was run just prior to the ng build
so it seemed redundant. Not so apparently!
I didn't find out WHY nodejs 0.10.x
was being referenced in some way.
I've just received an Answer from @PeterPan about choosing default nodejs versions. That may answer why a different version is being used (because there is a default that fortunately can be chosen). I aim to test out Peter's answer.
I don't like the way Azure (Windows NT server at least) node installs don't work exactly the same way as on my MacOSX box. Node is cross-platform and should behave the same everywhere (bar for platform specific modules like fsevents
). I believe this to be a failure. As a reminder, I have one way for Mac / Linux and another for Azure.
I will alternatively try and install this node / express / angular web app on Linux under Azure and see if that is better (unfortunately where I work is locked in to thinking 'Windows' so I don't think I will gain much ground that way).
Kudos to Microsoft for allowing the use of bash scripts.
There is a wiki page Node versioning of Project Kudu for Azure WebApps which can answer your question about Node version. Before Oct 31, 2017 when the wiki page be edited, the default node version is v0.6.20
, now it is 0.10.40
. It seems to be up to the deployment template of Azure WebApps.
After your webapp was created, you can configure the value of Azure Website environment variable WEBSITE_NODE_DEFAULT_VERSION
to change the default Node version in the tab Application settings
of Azure portal, as the figure below, like the subsection Change the Node version of the wiki page Configurable settings
said.
About the all available Node versions in Azure WebApps, you can command ls
under the path D:\Program Files (x86)\nodejs
of Kudu console to list them as the figure below.
After you set the WEBSITE_NODE_DEFAULT_VERSION
, your website will autorestart and the Node version has been upgraded.
Then you can make your script works directly on the current Node version, without considering for these environment variables like PATH
or others about Node.