ClareSudbery
ClareSudbery

Reputation: 391

How to convert command from GitBash to Windows command line?

I am trying to run my Jasmine tests using Karma on the command line. I am running in Visual Studio, which seems to use Windows command prompt in its "terminal" window. I have a command which works in GitBash but not the Visual Studio Code terminal. This is the command I am trying to run:

node_modules/karma/bin/karma start karma.conf.js --single-run

The folder structure is correct - that is to say, I have a nested folder structure that matches node_modules/karma/bin, and I have a file at that location called karma.

I am starting from the same location in both instances. When I run this command in Visual Studio Code terminal, or windows command prompt, I get the following error:

'node_modules' is not recognized as an internal or external command, operable program or batch file.

But in GitBash, it works just fine.

It is very hard to come up with an appropriate google search term that describes what I am trying to do!

I have tried:

Can anybody help??

Upvotes: 1

Views: 1382

Answers (1)

ClareSudbery
ClareSudbery

Reputation: 391

Fixed!

It turns out I needed to do a couple of things:

  1. Install the karma command-line interface like this:

    npm install -g karma-cli
    
  2. Adjust my original command. By installing the command-line interface globally, this changed the path of the resulting karma file, from

    node_modules\karma\bin to node_modules\\.bin.
    

So I had to run this to get it working:

node_modules\\.bin\karma start karma.conf.js --single-run

Upvotes: 1

Related Questions