How to use latest npm on Azure Mobile Service deployment - azure

The Azure Mobile Service image that I am using currently is locked down to npm version 1.2.30. There are latest npm version installed on the image(under ...\Program Files(x86)\npm). But npm is locked down to the version 1.2.30 due to the reason that it was installed with node.js(under ...\Program Files(x86)\nodejs) AND the path always looks under \nodejs\ folder first and uses it.
This is causing me problem in using some npm packages (including googleapis) on deployment. The errors appear while installing googleapis are bugs in older version of npm and are resolved in latest.
The simplest solution is to delete the 'npm' file and 'npm.cmd' file under ...\Program Files(x86)\nodejs\ folder so that the npm is read from ..\Program Files(x86)\npm\ folder. But i get access denied errors while trying to access these files. I am accessing the mobile service image through Kudu interface.
Is there are work-around for this?

For upgrading npm, you can follow the instructions from David Ebbo on this forum post: https://social.msdn.microsoft.com/Forums/azure/en-US/068ef026-f80d-4bf8-9f40-5d1af33a1024/git-deployment-fails-with-npm-error-when-resolving-a-package-version-containing-a-?forum=windowsazurewebsitespreview

Related

Azure Deployment Angular .NetCore

I have a project .NetCore Angular and i try to publish it on azure using FTP.
Once the FTP is done publishing the files, and i access the website i am getting an error
npm ERR! node -v v0.6.20
npm ERR! npm -v 1.1.37
Please take note on my local environment i am using node version 12.14.0
I am suspecting the error happens of my node version on my Azure Enviroment. My Question right now,is that how do i update
node version on my azure environment.
Thanks In advance.
Sincerely yours,
Pong
You can set the WEBSITE_NODE_DEFAULT_VERSION in the portal by checking the nodejs version from D://program files(x86)/nodejs.-
From all the available versions, choose one and update WEBSITE_NODE_DEFAULT_VERSION. Also keep in mind that Azure Functions runtime v1(~1) locks your node version at v6.11.
To use a configurable Node.js runtime, you'll, need to upgrade your Functions runtime to v2.x:
Go through this doc for more reference : NodeJS Version reference doc

Azure DevOps self hosted agent reports wrong version for NPM

We have updated Node to version 10.16.3 and NPM to version 6.11.3 (all the latest at this time) on our Windows based self hosted agent.
However, in a job run logs, we see that the agent reports version 6.9.0 for NPM, which is the default version for Node 10.16.3 installation.
Inside the VM where the hosted agent is, if I run 'npm' in the CMD, I get the latest version for NPM. Also, if I run the same command that the agent is running to get the version, I still get the correct version for NPM:
What could be wrong here?
The reason we want the latest version of NPM is because our builds run faster with it.
Thank you!
We have had a very amateur approach to this problem. When we are logging in through RDP, we are using the user 'agent' and all installations are scoped to that user. However, the agent is using the NetworkService user, which has its own scope for NPM and Node.
The fix was basically to add step in our build pipeline to check for latest version of NPM and install it in case it is not installed.
Yeah, I got caught out by this too. Because it runs under the NetworkService account, it can't read the global folder, so has it's own little copy/cache at
C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\npm
My easiest way to get back up and running, was to just manually upgrade the npm at that location using the following command:
npm install --prefix C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\npm npm

How force the download of npm modules located in private nexus npm registry instead local modules?

Scenario
I have a configured nexus repository working as npm registry with redeploy enabled. I know that enable redeploy is a bad practice, but we are in stabilization stage.
Problem
When I try to install my private module into local nodejs project, I always get the previous version:
npm install acme-module --save
Validations
I deleted the folder in nexus repository and perform a new npm publish without any errors.
I can see the new folder, with correct .tgz and if I download it (right click and save) I can see my latest version of source code, which is good.
I tried to uninstall all npm modules, but always the previous version is downloaded.
Possible cause
If I disconnect from the internet, npm install is still working without any error. So I guess, my npm private module acme-module, is cached in some folder, and this prevent the download of latest version.
Question
Why npm install works without internet connection and how force the download of exact versions, located in my nexus registry instead local modules.
Similar questions
Force npm download from private registry (without response :S)

Npm download tarball failed due to broken url

I'm trying to install tileserver-gl to host my own OSM server on my windows machine.
At the moment, I have tried to install locally and via npm without much success.
The issue being, npm is unable to get 'mapbox-gl-native' from the specific web address.
I have seen similar issues to this, from this github issue thread , Link Here. In which they have provided an alternate download link.
I have tried to download the tileserver-gl files from the repo, manually put the required files inside, run npm install & npm install from source but to no avail.
There are online topics which said to use Node v4 , which i already tried on both Node v6 and Node v4 .
How do I fix this issue?

tfs 2017 on site npm build

I am trying to get a npm build of SPA application using the npm build task. I need the task to use the latest Nodejs and NPM, how can I update the binaries of the task? I have installed the Nodejs on the TFS Build machine but the npm task is not using the latest version, it seems there is another version fixed to tfs in some location
Normally you just need to update the Nodejs to the latest version, then the NPM task will call the latest version of Nodejs accordingly.
So, please check if you have installed multiple versions of Nodejs in different directory, If it is, just remove the old one.
And go to your pool settings page: http://server:8080/tfs/_admin/_AgentPool and select your agent, verify that if the Node.exe and NPM are identified as a system capability with the correct path set. If the latest version not existing there, just try to restart the agent service to sync it, if still not be identified, you can try to add it manually. Then try it again.

Resources