Search code examples
cachingcypressnode-modules

SyntaxError Unexpected token in Cypress


I am trying to setup Cypress in my laptop, but I get this error when I try to execute the example tests. I tried to clear the cypress cache and reinstall cypress, but got the same error. here is screen shot of what syntax error I receive when I hit "npm run test".

This is what I get in the terminal after I hit "npm run test"

C:\Users\u46827\AppData\Local\Cypress\Cache\10.7.0\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_plugins.js:40
invoke = (eventId, args = []) => {

SyntaxError: Unexpected token =
   at new Script (vm.js:79:7)
   at createScript (vm.js:251:10)
   at Object.runInThisContext (vm.js:303:10)
   at Module._compile (internal/modules/cjs/loader.js:656:28)
   at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
   at Module.load (internal/modules/cjs/loader.js:598:32)
   at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
   at Function.Module._load (internal/modules/cjs/loader.js:529:3)
   at Module.require (internal/modules/cjs/loader.js:636:17)
   at require (internal/modules/cjs/helpers.js:20:18)
   at Object.<anonymous> (C:\Users\u46827\AppData\Local\Cypress\Cache\10.7.0\Cypress\resources\app\node_modules\@packages\server\lib\plugins\child\run_require_async_child.js:6:24)
   at Module._compile (internal/modules/cjs/loader.js:688:30)
   at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
   at Module.load (internal/modules/cjs/loader.js:598:32)
   at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
   at Function.Module._load (internal/modules/cjs/loader.js:529:3)

[3544:0904/215759.289:ERROR:dns_config_service.cc(278)] DNS config watch failed.

Please open screenshot here


Solution

  • I found the issue. My node version was old. I updated it to 16