loretoparisi loretoparisi - 2 months ago 11x
Node.js Question

How to install a npm scoped module on Microsoft Azure Web Sites

My company has private scoped

modules i.e. the ones starting with
. By defaults all scoped modules in npm are private so you have to login first before publish

npm login
npm publish

The scoped module must have the property
with a scope in the

"name": "@mycompanyscope/mymodule"

and the
key must be removed.

As soon as you login you get a
in the
file in your
folder, that is like


At this point everything is properly setup to
in this machine. If you grant access to other users, they can do
npm login
on their machines and get a token to work from there.

The problems come on the server side, depending on your server. On Heroku it should work as explained here.

My server environment is Azure Web Sites. According to some docs, you should upload your
file to Azure during the deploying phase, and that would awesome, if I would have a way to get a token for that machine.
If I try to login to
Kudu PowerShell
, the fact is that I just cannot login, the login process hangs at some point:

Kudu Remote Execution Console
Type 'exit' then hit 'enter' to get a new powershell process.
Type 'cls' to clear the console

PS D:\home> npm login
Username: mycompany
Password: *********
Email: (this IS public) npm@mycompany.com

so that I cannot generate any token from this machine. So how can I grant access here to let the
npm install
to run correctly for private scoped modules?

Thanks to the answer below I was able to deploy the npm scoped module (@ mycompanyscope/myModule) to Azure Web Sites, creating the
file in the project root folder (where the
is) and then writing there the token obtained after the
npm login
, and adding the
to the



Have you tried to npm login your private npm registry on your local machine, to generate a .npmrc file in your node.js application, then deploy to Azure Web App with your application.

Please refer to https://blog.maartenballiauw.be/post/2015/10/13/working-with-a-private-npm-registry-in-azure-web-apps.html for more details.

Any update or further concern, please feel free to let me know.