S.Selva
S.Selva

Reputation: 11

'protractor' is not recognized as an internal or external command when installed locally

I installed protractor in local folder using 'npm install protractor'. After installed complete I checked the version of protractor using protractor --version.

But it is gives error:

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

How to solve this error?

Upvotes: 1

Views: 19841

Answers (3)

Amir Shirazi
Amir Shirazi

Reputation: 836

Try to run it locally by npm run protractor. Make sure you have required scripts in your package.json. A sample one is like below:

    "scripts": {
        "preprotractor": "webdriver-manager update",
        "protractor": "protractor ./e2e/protractor.conf.js",
    },

Upvotes: 1

surya vallabhaneni
surya vallabhaneni

Reputation: 920

I have a similar problem on Windows Server 2016. Following steps should resolve it:

Make sure the installation is global.

npm install -g protractor

Make sure npm is set in PATH environment variable. Go to "Edit environment variables for your system", Append the following line to the Path variable.

%USERPROFILE%\AppData\Roaming\npm

Upvotes: 6

M.Navy
M.Navy

Reputation: 155

If you install in local using npm install protractor Your module will be installed only in your local directory.

You should use npm install -g protractor which will install the module in global path and made available as a environment variable. So that your machine will recognize it as a command.

Upvotes: 0

Related Questions