andy
andy

Reputation: 2181

how to use npm in azure cli?

I wanted to make a chatbot with(https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-tutorial-dispatch?view=azure-bot-service-4.0&tabs=python)

The tutorial asks me to install botdispatch with npm. So I use "npm i -g npm" in cloud cli, but I can't do that due to permission denied.

Is there some way I can solve this in cloud cli? Or I need to install cli locally?Are there any differences between cloud cli and local cli?

Upvotes: 0

Views: 782

Answers (1)

Jack Jia
Jack Jia

Reputation: 5549

The Azure Cloud CLI is a sandbox environment. You do not have admin privileges in this environment.

However, npm i -g will try to install module for global, which needs admin privilege. So the cmd will fail.

So, you may just remove -g in the cmd. And then specify the whole path of the js module. For example:

npm i botdispatch

./node_modules/botdispatch/bin/dispatch.js init -n <filename-to-create> --luisAuthoringKey "<your-luis-authoring-key>" --luisAuthoringRegion <your-region>

Or, you can use CLI and NPM locally, which will certainly work if you are the admin user.

Upvotes: 1

Related Questions