SyntaxError: Unexpected token while working with protractor on the local machine

SyntaxError: Unexpected token while working with protractor on local machine

 ERROR log

D:\Protractor\node_modules\protractor\built\logger.js:76
 info(...msgs) {
 ^^^
 SyntaxError: Unexpected token ...
 at exports.runInThisContext (vm.js:53:16)
 at Module._compile (module.js:414:25)
 at Object.Module._extensions..js (module.js:442:10)
 at Module.load (module.js:356:32)
 at Function.Module._load (module.js:313:12)
 at Module.require (module.js:366:17)
 at require (module.js:385:17)
 at Object. (D:\gramLabs\code\Protractor\gramLabs\node_modules\protractor\built\configParser.js:6:18)
 at Module._compile (module.js:435:26)
 at Object.Module._extensions..js (module.js:442:10)

SOLUTION

  • Make sure node js is installed on the local machine.
  • Make sure npm is installed on the local machine.
  • Make sure protractor is installed on the local machine.
path
  • Make sure the PATH variable has npm.
cmd-version

In eclipse, check the node js has the proper version and is pointing to the latest or node 4 above version.

  • Open eclipse –> Window –> Preferences –> AngularJS –> Protractor.
  • Now node.js install –> Node.js path, here check the path which is mentioned and go to this directory path.
protractor-preferences

Now, where ever you have your latest node installed on the local machine, copy the node directories on this location. For example from Program Files–Nodejs to the location which eclipse is showing.

node-js-program-files
copy-node-modules-node-exe

Now, refresh, clean, and restart the eclipse.

It should work.

Author: Khyati Sehgal

Khyati has more than 12 years of experience in quality assurance engineering. Khyati has worked extensively on Manual and Automation testing of various technologies and domains like data quality. From last 6 years, She is leading QA Activities on Agile/Scrum projects while continuously contributing in playing role as a Scrum master, continuous integration, iteration planning, facilitating requirement analysis and closure. On automation front, She has explored gui, web services and mobile automation. Tools/ Technologies used:- Selenium/WebDriver, Core Java, JUnit, TestNG, Maven, SoapUI. Jenkins, Appium, Selenium backed and selenium remote driver. Have delve into android phone/tab of verison upto 6 (marshmallow), ios phone/i pad, and mobile websites

9 thoughts on “SyntaxError: Unexpected token while working with protractor on the local machine”

  1. An interesting discussion is definitely worth comment.I believe that you ought to publish more about this subject,it may not be a taboo matter but usually folks don’t discuss suchissues. To the next! Many thanks!!

    Like

Leave a comment