Home > Net >  How do I run an npm script directly in VS code terminal
How do I run an npm script directly in VS code terminal

Time:11-30

I am trying to follow this MS tutorial.

So I install the CLI from the VS code terminal: npm install @azure/static-web-apps-cli

Works.

But following the instructions using "swa init" in the terminal I get this response:

swa : The term 'swa' is not recognized.... etc.

Adding the command to package.json as a script will work, but how do I run it directly from the terminal without adding it to package.json?

CodePudding user response:

npx swa init would pull the swa package and execute it as if it was run from within package.json. You can read more about it on npmjs.com/package/npx

Alternatively, you could have the swa package installed globally with npm i -g @azure/static-web-apps-cli

  • Related