cypress: EEXIST: file already exists - cannot start server on Windows

Is this a Feature or Bug?

Bug

Current behavior:

When installing and running Cypress on Windows, I get the following error:

Error: EEXIST: file already exists, mkdir 'C:\Users\aaron\Roaming\node_modules\.bin\cypress

This has been duplicated on both Windows 7 and Windows 10.

Debug output
Wed, 20 Dec 2017 02:09:32 GMT cypress:ts Running without ts-node hook in environment "production"
Wed, 20 Dec 2017 02:09:33 GMT cypress:server:appdata path: C:\Users\aaron\AppData\tmp\Cypress\cy\production
Wed, 20 Dec 2017 02:09:33 GMT cypress:server starting cypress server
Wed, 20 Dec 2017 02:09:33 GMT cypress:server:appdata path: C:\Users\aaron\AppData\tmp\Cypress\cy\production
Wed, 20 Dec 2017 02:09:37 GMT cypress:server start in mode headed with options {"_":["C:\\Users\\aaron\\tmp\\node_modules\\cypress\\dist\\Cypress\\Cypress.exe"],"project":"C:\\Users\\aaron\\tmp\\node_modules\\.bin","projectPath":"C:\\Users\\aaron\\tmp\\node_modules\\.bin"}
Wed, 20 Dec 2017 02:09:43 GMT cypress:server:appdata path: C:\Users\aaron\AppData\tmp\Cypress\cy\production\browsers
Wed, 20 Dec 2017 02:09:44 GMT cypress:server:appdata path: C:\Users\aaron\AppData\tmp\Cypress\cy\production\cache
Wed, 20 Dec 2017 02:10:00 GMT cypress:server:timers queuing timer id 1 after 500 ms
Wed, 20 Dec 2017 02:10:00 GMT cypress:server:timers child received timer id 1
Wed, 20 Dec 2017 02:10:00 GMT cypress:server:timers child sending timer id 1
Wed, 20 Dec 2017 02:10:00 GMT cypress:server:timers clearing timer id 1 from queue { '1': { args: [], ms: 500, cb: [Function] } }
Wed, 20 Dec 2017 02:10:00 GMT cypress:server making saved state from C:\Users\aaron\tmp\node_modules\cypress\dist\Cypress\resources\app\packages\server
Wed, 20 Dec 2017 02:10:00 GMT cypress:server for project path C:\Users\aaron\tmp\node_modules\.bin
Wed, 20 Dec 2017 02:10:00 GMT cypress:server state path for project C:\Users\aaron\tmp\node_modules\.bin
Wed, 20 Dec 2017 02:10:00 GMT cypress:server:appdata path: C:\Users\aaron\AppData\tmp\Cypress\cy\production\projects\.bin-51b4388fba0de7ac28bff8df9045a210\state.json
Wed, 20 Dec 2017 02:10:00 GMT cypress:server full state path C:\Users\aaron\AppData\tmp\Cypress\cy\production\projects\.bin-51b4388fba0de7ac28bff8df9045a210\state.json
Wed, 20 Dec 2017 02:10:00 GMT cypress:server making new state file around C:\Users\aaron\AppData\tmp\Cypress\cy\production\projects\.bin-51b4388fba0de7ac28bff8df9045a210\state.json
Wed, 20 Dec 2017 02:10:00 GMT cypress:server:file reading JSON file C:\Users\aaron\AppData\tmp\Cypress\cy\production\projects\.bin-51b4388fba0de7ac28bff8df9045a210\state.json
Wed, 20 Dec 2017 02:10:00 GMT cypress:server:windows creating electron window with options { backgroundColor: '#dfe2e4', width: 800, height: 550, minWidth: 458, minHeight: 400, x: null, y: null, type: 'INDEX', devTools: false, trackState: { width: 'appWidth', height: 'appHeight', x: 'appX', y: 'appY', devTools: 'isAppDevToolsOpen' }, onBlur: [Function: onBlur], onFocus: [Function: onFocus], onClose: [Function: onClose], show: true, url: 'file://C:\\Users\\aaron\\tmp\\node_modules\\cypress\\dist\\Cypress\\resources\\app\\packages\\desktop-gui\\dist\\index.html', webPreferences: { preload: 'C:\\Users\\aaron\\tmp\\node_modules\\cypress\\dist\\Cypress\\resources\\app\\packages\\server\\lib\\ipc\\ipc.js', chromeWebSecurity: true, nodeIntegration: false, backgroundThrottling: false, backgroundColor: '#dfe2e4' }, frame: true, contextMenu: false, recordFrameRate: null, onPaint: null, onCrashed: [Function: onCrashed], onNewWindow: [Function: onNewWindow] }
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:events got request for event: on:menu:clicked undefined
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:events got request for event: get:options undefined
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:events sending ipc data { type: 'get:options',
  data: 
   { id: 0.6289514760541144,
     data: 
      { _: [Object],
        project: 'C:\\Users\\aaron\\tmp\\node_modules\\.bin',
        projectPath: 'C:\\Users\\aaron\\tmp\\node_modules\\.bin',
        onFocusTests: [Function: onFocusTests],
        os: 'win32',
        version: '1.4.0' } } }
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:events got request for event: get:current:user undefined
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:file reading JSON file C:\Users\aaron\AppData\tmp\Cypress\cy\production\cache
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:events sending ipc data { type: 'get:current:user',
  data: { id: 0.3762137311755782, data: {} } }
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:events got request for event: on:focus:tests undefined
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:events got request for event: on:spec:changed undefined
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:events got request for event: on:config:changed undefined
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:events got request for event: on:project:error undefined
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:events got request for event: on:project:warning undefined
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:events got request for event: open:project C:\Users\aaron\tmp\node_modules\.bin
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:project Project created C:\Users\aaron\tmp\node_modules\.bin
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:events got request for event: updater:check undefined
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:updater checking for new version of Cypress. current version is 1.4.0
Wed, 20 Dec 2017 02:10:02 GMT cypress:launcher checking one browser chrome
Wed, 20 Dec 2017 02:10:02 GMT cypress:launcher looking up chrome on win32 platform
Wed, 20 Dec 2017 02:10:02 GMT cypress:launcher exe path C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
Wed, 20 Dec 2017 02:10:02 GMT cypress:launcher found C:\Program Files (x86)\Google\Chrome\Application\chrome.exe ? true
Wed, 20 Dec 2017 02:10:02 GMT cypress:launcher Version=63.0.3239.84
Wed, 20 Dec 2017 02:10:02 GMT cypress:launcher browser chrome at 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe' version 63.0.3239.84
Wed, 20 Dec 2017 02:10:02 GMT cypress:launcher setting major version for {"name":"chrome","displayName":"Chrome","version":"63.0.3239.84","path":"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"}
Wed, 20 Dec 2017 02:10:02 GMT cypress:launcher browser chrome version 63.0.3239.84 major version 63
Wed, 20 Dec 2017 02:10:02 GMT cypress:launcher checking one browser chromium
Wed, 20 Dec 2017 02:10:02 GMT cypress:launcher looking up chromium on win32 platform
Wed, 20 Dec 2017 02:10:02 GMT cypress:launcher exe path C:\Program Files (x86)\Google\chrome-win32\chrome.exe
Wed, 20 Dec 2017 02:10:02 GMT cypress:launcher found C:\Program Files (x86)\Google\chrome-win32\chrome.exe ? false
Wed, 20 Dec 2017 02:10:02 GMT cypress:launcher browser chromium not installed
Wed, 20 Dec 2017 02:10:02 GMT cypress:launcher checking one browser canary
Wed, 20 Dec 2017 02:10:02 GMT cypress:launcher looking up canary on win32 platform
Wed, 20 Dec 2017 02:10:02 GMT cypress:launcher exe path C:\Users\aaron\AppData\Local\Google\Chrome SxS\Application\chrome.exe
Wed, 20 Dec 2017 02:10:02 GMT cypress:launcher found C:\Users\aaron\AppData\Local\Google\Chrome SxS\Application\chrome.exe ? false
Wed, 20 Dec 2017 02:10:02 GMT cypress:launcher browser canary not installed
Wed, 20 Dec 2017 02:10:02 GMT cypress:server opening project C:\Users\aaron\tmp\node_modules\.bin
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:project opening project instance C:\Users\aaron\tmp\node_modules\.bin
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:config setting support file C:\Users\aaron\tmp\node_modules\.bin\cypress\support
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:config for project root C:\Users\aaron\tmp\node_modules\.bin
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:config support file C:\Users\aaron\tmp\node_modules\.bin\cypress\support does not exist
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:config support file is default, check if C:\Users\aaron\tmp\node_modules\.bin\cypress exists
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:config support folder does not exist, set to default index.js
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:config set support folder C:\Users\aaron\tmp\node_modules\.bin\cypress\support
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:config setting plugins file C:\Users\aaron\tmp\node_modules\.bin\cypress\plugins
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:config for project root C:\Users\aaron\tmp\node_modules\.bin
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:config plugins file does not exist
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:config plugins file is default, check if C:\Users\aaron\tmp\node_modules\.bin\cypress exists
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:config plugins folder does not exist, set to default index.js
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:scaffold scaffolded files ["cypress\\integration\\example_spec.js","cypress\\fixtures\\example.json","cypress\\support\\commands.js","cypress\\support\\index.js","cypress\\plugins\\index.js"]
Wed, 20 Dec 2017 02:10:02 GMT cypress:server making saved state from C:\Users\aaron\tmp\node_modules\cypress\dist\Cypress\resources\app\packages\server
Wed, 20 Dec 2017 02:10:02 GMT cypress:server for project path C:\Users\aaron\tmp\node_modules\.bin
Wed, 20 Dec 2017 02:10:02 GMT cypress:server state path for project C:\Users\aaron\tmp\node_modules\.bin
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:appdata path: C:\Users\aaron\AppData\tmp\Cypress\cy\production\projects\.bin-51b4388fba0de7ac28bff8df9045a210\state.json
Wed, 20 Dec 2017 02:10:02 GMT cypress:server full state path C:\Users\aaron\AppData\tmp\Cypress\cy\production\projects\.bin-51b4388fba0de7ac28bff8df9045a210\state.json
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:file reading JSON file C:\Users\aaron\AppData\tmp\Cypress\cy\production\projects\.bin-51b4388fba0de7ac28bff8df9045a210\state.json
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:scaffold found 0 files in folder C:\Users\aaron\tmp\node_modules\.bin\cypress\integration
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:scaffold untouched scaffold true modal closed false
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:scaffold plugins folder C:\Users\aaron\tmp\node_modules\.bin\cypress\plugins
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:scaffold verify scaffolding in C:\Users\aaron\tmp\node_modules\.bin\cypress\plugins
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:scaffold missing folder C:\Users\aaron\tmp\node_modules\.bin\cypress\plugins
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:scaffold copying index.js into C:\Users\aaron\tmp\node_modules\.bin\cypress\plugins
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:scaffold scaffolded files ["cypress\\integration\\example_spec.js","cypress\\fixtures\\example.json","cypress\\support\\commands.js","cypress\\support\\index.js","cypress\\plugins\\index.js"]
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:events send error: { Error: EEXIST: file already exists, mkdir 'C:\Users\aaron\tmp\node_modules\.bin\cypress'
    at Error (native)

  cause: 
   { Error: EEXIST: file already exists, mkdir 'C:\Users\aaron\tmp\node_modules\.bin\cypress'
       at Error (native)
   
     errno: -4075,
     code: 'EEXIST',
     syscall: 'mkdir',
     path: 'C:\\Users\\aaron\\tmp\\node_modules\\.bin\\cypress' },
  isOperational: true,
  errno: -4075,
  code: 'EEXIST',
  syscall: 'mkdir',
  path: 'C:\\Users\\aaron\\tmp\\node_modules\\.bin\\cypress' }
Wed, 20 Dec 2017 02:10:02 GMT cypress:server:events sending ipc data { type: 'open:project',
  data: 
   { id: 0.4466535685737474,
     __error: 
      { name: 'Error',
        stack: 'Error: EEXIST: file already exists, mkdir \'C:\\Users\\aaron\\tmp\\node_modules\\.bin\\cypress\'\n    at Error (native)\n',
        message: 'EEXIST: file already exists, mkdir \'C:\\Users\\aaron\\tmp\\node_modules\\.bin\\cypress\'',
        cause: [Object],
        isOperational: true,
        errno: -4075,
        code: 'EEXIST',
        syscall: 'mkdir',
        path: 'C:\\Users\\aaron\\tmp\\node_modules\\.bin\\cypress' } } }
Wed, 20 Dec 2017 02:10:03 GMT cypress:server:updater latest version of Cypress is: 1.4.0
Wed, 20 Dec 2017 02:10:03 GMT cypress:server:updater new version of Cypress does not exist
Wed, 20 Dec 2017 02:10:03 GMT cypress:server:events sending ipc data { type: 'updater:check',
  data: { id: 0.786888422730067, data: false } }

  • Operating System: Windows 7 & 10
  • Cypress Version: 1.0.3 & 1.3.0
  • Browser Version: Chrome 63

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 41 (6 by maintainers)

Most upvoted comments

I have the same problem with steps above. Fortunately, I run cypress. I’ve created script inside package.json:

{
  "scripts": {
    "test": "cypress open"
  }
}

Run command: npm run test

All works fine for me

How to make run cypress.io on your Windows 10 system.

11

Didn’t work for me as well. I got the same error.

  1. I’ve created new folder in the repo.
  2. Run npm init -y
  3. Run npm install --save-dev cypress
  4. Then go to ./node_modules/.bin/cypress open And boom the error. Thanks to @kolasv I’ve workaround it by adding:
{
  "scripts": {
    "test": "cypress open"
  }
}

into package.json and run cypress with npm run test

This is a local account and is an administrator for the computer. I have UAC on the recommended setting, not sure if that’s causing anything. It does happen every single time I open it. Same with a co-worker on Windows 7.

Are you running this on CMD?

This is what I do:

  1. New project: mkdir foo
  2. npm init -y
  3. npm install --save-dev cypress
  4. cd ./node_modules\.bin\
  5. cypress open
  6. crash.

For step 4, if I do .\node_modules\.bin\cypress open it works. I just tried it now for the first time. The reason I was CD’ing into the directory is because I was getting '.' is not a recognized internal or external command....

Can you try to replicate and see if doing it the way I had it will break it.

I had the same issue and i followed the above mentioned steps

{
  "scripts": {
    "test": "cypress open"
  }
}

Run command: npm run test

and i got the following error:

ENOENT: no such file or directory, open 'C:\Users\<user>\package.json

after that i paste the package.json file from

C:\Users\<user>\node_modules\cypress\package.json

to

C:\Users\<user>\package.json

and that worked for me.

@padmarajnidagundi i followed the steps you mentioned and it’s working for me

this worked for me … C:\_temp\_cypress_windows_test>.\node_modules\.bin\cypress open

as mentioned above, you have to be in the correct directory first.

Cypress package version: 2.0.3 Windows 10 Pro Node v6.11.0 Npm 3.10.10

Okay, Forget about me. I did not follow the instructions properly. I was in the wrong folder once I typed in .\node_modules\.bin\cypress open I got past that. I was in the wrong folder last time… Are there instructions out there that are not gif. I tried to pause it, but of course that did not work. Also thanks for doing this, I might throw protractor out if this works for me.

Hopefully, It will work for you

Start a brand new project like mkdir Some npm init -y npm install --save-dev cypress ./node_modules/.bin/cypress open After opening the cypress dialog with error, Just delete the already existing file “Cypress” from ./node_modules/.bin/

After I deleted the file it is work for me. Thanks

this worked for me … C:\_temp\_cypress_windows_test>.\node_modules\.bin\cypress open

as mentioned above, you have to be in the correct directory first.

Cypress package version: 2.0.3 Windows 10 Pro Node v6.11.0 Npm 3.10.10

This helped me. You have to be in the root directory of the project and then enter: .\node_modules.bin\cypress open

I first navigated to .\bin and typed cypress open, which didn’t work.

I created a new issue in our docs to document that you need to execute the CLI commands from the same directory that your package.json is located here: https://github.com/cypress-io/cypress-documentation/issues/1364. Our documentation is open source and contributions are welcome. 😄

That is so weird. I installed Cypress on the D:\cypress.io with NPM install cypress

If I’m in the command prompt and attempt to execute cypress from the relative directory

d:\cypress.io\node_modules\.bin>cypress open

I get the EEXIST: file already exists… Error

However, if I open cypress from a different directory.

d:\cypress.io>.\node_modules\.bin\cypress open

Cypress then executes correctly, in any case ryangz’s suggestion worked for me.

This is because the command should be executed from the directory that contains the package.json file. Hope this clarifies.

this worked for me … C:\_temp\_cypress_windows_test>.\node_modules\.bin\cypress open

as mentioned above, you have to be in the correct directory first.

Cypress package version: 2.0.3 Windows 10 Pro Node v6.11.0 Npm 3.10.10

I’ve met the same issue when i type cypress on in the .bin folder

C:\Users\xyz\node_modules\ .bin>cypress open 
[Not work, Error: EEXIST: file already exists]

It is worked when I using the path as suggested:

C:\Users\xyz>.\node_modules\ .bin\cypress open 
[Works well, cool]