protractor icon indicating copy to clipboard operation
protractor copied to clipboard

Local installation of protractor does not work

Open amodmahajan2016 opened this issue 7 years ago • 4 comments

Steps to reproduce:-

  1. Create a folder.
  2. Init npm.
  3. Add protractor in package.json
  4. Run npm install
  5. I see node_modules folder and protractor in it.
  6. Type protractor --version in same folder cmd. I am expecting it to give version of protractor as I installed it locally and accessing it from same folder. But I get "'protractor' is not recognized as an internal or external command, operable program or batch file". Node version:- 10.15.3 Npm version:- 6.4.1 Protractor version:- 5.4.2

Is it mandatory to install protractor globally?

amodmahajan2016 avatar Jul 09 '19 05:07 amodmahajan2016

I think, this is the correct behavior. If you have not installed the protractor globally, your system will not recognize the protractor commands & you could only see the version of protractor inside node-modules or in package.json. However, still you want to see the locally installed protractor version you can add "protractor-version": "protractor --version" under "scripts" in your package.json & then run "npm run protractor-version" would show valid version.

hegdepavan avatar Jul 09 '19 10:07 hegdepavan

Another strategy is to simply refer to the binary locally installed:

./node_modules/.bin/protractor --version

That's what the npm-scripts is doing internally.

jniles avatar Jul 09 '19 10:07 jniles

Use npx for run local packages. It's better to ask these kind of questions on stackoverflow

niyarlatotep avatar Jul 10 '19 04:07 niyarlatotep

When you want create an issue on an Open Source project it's best to read the CONTRIBUTING.md guidelines or at least read the default text that appears in the "New Issue" form. Both specify that you should ask usage and debugging questions on discussion forums, not in the project issue queue.

  1. Make sure you are not asking a usage or debugging question. If you are, use StackOverflow, Google Group discussion list, or Gitter to get help.

Please close this issue and post your question somewhere else.

SchnWalter avatar Apr 14 '20 22:04 SchnWalter