cypress: Unable to add cypress on an existing project in Windows 10

Unable to install cypress on an existing react project on Windows 10 machine. Here is the error:

> cypress@6.2.0 postinstall C:\Users\ShreyaJ\Desktop\generic-user-portal\node_modules\cypress
> node index.js --exec install

C:\Users\ShreyaJ\Desktop\generic-user-portal\node_modules\cypress\node_modules\fs-extra\lib\mkdirs\make-dir.js:85
      } catch {
              ^

SyntaxError: Unexpected token {
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Users\ShreyaJ\Desktop\generic-user-portal\node_modules\cypress\node_modules\fs-extra\lib\mkdirs\index.js:3:44)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:49


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cypress@6.2.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\ShreyaJ\AppData\Roaming\npm-cache\_logs\2020-12-22T20_41_20_421Z-debug.log

Any help would be appreciated. Able to install cypress in a fresh new project on the same machine.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (4 by maintainers)

Most upvoted comments

Yah, this does look like the error you would generally see if you have a version of Node that’s not supported by us. But our min version is v10 still, so 12.18.3 should be fine.

Seems identical to this issue, which says to upgrade above Node.js 10. https://github.com/google/docsy/issues/265