Error: EINVAL: invalid argument, mkdir on windows for cypress + windows + Angular project
See original GitHub issueCurrent behavior:
When cypres@3.8.3 is run on windows in Angular project, i am getting this type of error when i click on any test specs and try to run and capture image snapshot:
Error: EINVAL: invalid argument, mkdir 'C:\Users\rocks\AppData\Roaming\Cypress\cy\production\projects\styleguide-e2e-a8ba09f50d81ec188e3b12528503dca9\bundles\C:\Users\rocks\project\torque\styleguide\cypress\support
Cypress cache folder is: C:\Users\rocks\AppData\Roaming\Cypress\cy\production\projects for windows.
Desired behavior:
It should not throw any error on windows system.
Test code to reproduce
Package.json
{
"cypress": "3.8.3",
"cypress-axe": "^0.8.1",
"cypress-cucumber-preprocessor": "^2.0.1",
"cypress-image-snapshot": "^3.1.1",
}
NPM command to open cypress:
npm run nx-high-memory -- e2e styleguide-e2e --watch
```
cypress.josn config file
```json
{
"video": false,
"testFiles": "**/*.{feature,features}",
"fixturesFolder": "../../cypress/fixtures",
"integrationFolder": "../../cypress/integration",
"pluginsFile": "../../cypress/plugins/index",
"supportFile": "../../cypress/support/index",
"screenshotsFolder": "../../cypress/screenshots"
}
```
<!-- If we cannot fully run the tests as provided the issue WILL BE CLOSED -->
<!-- Issues without a reproducible example WILL BE CLOSED -->
<!-- You can fork https://github.com/cypress-io/cypress-test-tiny repo, set up a failing test, then link to your fork -->
### Versions
```json
"cypress": "3.8.3",
"cypress-axe": "^0.8.1",
"cypress-cucumber-preprocessor": "^2.0.1",
"cypress-image-snapshot": "^3.1.1",
"chrome": "Version 85.0.4183.102 (Official Build) (64-bit)"
"windows": 10
```
<!-- Cypress, operating system, browser -->
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:22 (3 by maintainers)
Top Results From Across the Web
cypress-io/cypress - Gitter
Everything is working fine but an error running cypress in some windows machines. ... The error was: Error: EINVAL: invalid argument, mkdir ......
Read more >node.js - Error: EINVAL: invalid argument, mkdir 'C:\Users\user ...
Open the file .npmrc in your User folder, and focus on the setting prefix={path} . Delete the " or ' in the path...
Read more >Error: EINVAL: invalid argument, mkdir 'C:\Users\Peter.000\'C ...
Error : EINVAL: invalid argument, mkdir 'C:\Users\Peter.000\'C:\Users\User\AppData\Roaming\npm''. I have installed node 12.16.2. Unfortunately, when i run.
Read more >Yarn build: production assets error on windows - sage
Hello i'm starting with sage, i have windows 10 npm 6.14.11 node 14.6 I ... 95% emittingError: EINVAL: invalid argument, mkdir 'C: \...
Read more >Common errors | npm Docs
You are trying to install on a drive that either has no space, or has no permission to write. Free some disk space...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We found a workaround for this issue:
Create nested/cypressSupportForWindows.js file with content:
and then change nested/cypress.json to point that file
I am able to reproduce this by setting a relative
supportFilepath in configSetup Reproduction project: https://github.com/artkoselev/cypress8599 OS: Windows Cypress package version: 6.2.1 Cypress binary version: 6.2.1 Electron version: 11.1.1 Bundled Node version: 12.18.3
Reproduction steps
Expected: Cypress visits cypress.io page Actual: Error thrown -
Error: EINVAL: invalid argument, mkdir 'C:\Users\{user}\AppData\Roaming\Cypress\cy\production\projects\nested-0b20f090537cddae1cfb3da2204e4eae\bundles\C:\Users\{user}\cypress8599\supportNotes:
npm testcallsnpx cypress run --project nestedand nested project contains entry"supportFile": "../support/index.js". From the error message it seems that the path gets converted to absolute which results in an invalid argument for ‘mkdir’ -... bundles\C:\Users\{user}\ ...