Local installation of protractor does not work
Steps to reproduce:-
- Create a folder.
- Init npm.
- Add protractor in package.json
- Run npm install
- I see node_modules folder and protractor in it.
- 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?
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.
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.
Use npx for run local packages. It's better to ask these kind of questions on stackoverflow
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.
- 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.