angularjsprotractornpm-installgulp-protractor

Installing Protractor for Angular JS in VScode


I have npm installed globally and installed protractor globally as well. When I check for the node version it returns proper version, but when I am trying to check the version of protractor after installing it gives me the below error. can anyone help me with whats going wrong here?

protractor : The term 'protractor' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + protractor --version


Solution

  • You need to config the global protractor into PATH environment variable through below two steps:

    1. get npm global package install path by execute following cmd which will print out an absolute folder path.
    npm config get prefix
    
    1. add the install path/bin into PATH environment variable
      For example the step 1 print out xxx\yyy, you should add xxx\yyy\bin; into PATH on Windows, Or add xxx\yyy\bin: on Linux.

    Important: try protrator --version in new cmd window, Don't try again in previous opened cmd window.