Cypress verification timed out after 30000 milliseconds

avatar
Borislav Hadzhiev

Last updated: Apr 5, 2024
3 min

banner

# Cypress verification timed out after 30000 milliseconds

The error "Cypress verification timed out after 30000 milliseconds" occurs when the Cypress verification process times out.

Use the npx cypress verify command to resolve the issue or increase your timeout by setting the CYPRESS_VERIFY_TIMEOUT environment variable.

Here is the complete stack trace.

shell
It looks like this is your first time using Cypress Verifying Cypress can run Cypress verification timed out. This command failed with the following output: ------- Command timed out after 30000 milliseconds ------- Platform: win32 Cypress version:

# Using the npx cypress verify command to solve the error

One way to solve the error is to use the npx cypress verify command.

Open your terminal in your project's root directory (where your package.json file is) and run the following command.

shell
npx cypress verify

issue cypress verify command

The command verifies that Cypress is installed correctly and is executable.

The cypress open or cypress run commands execute the cypress verify command under the hood.

# Set the CYPRESS_VERIFY_TIMEOUT environment variable if the issue persists

If the error persists, the verification process might be timing out.

The default timeout is set to 30 seconds (=30000 milliseconds).

You can set the CYPRESS_VERIFY_TIMEOUT environment variable to increase the timeout.

For example, if you are on macOS or Linux, issue the following command in bash or zsh.

shell
# macOS or Linux export CYPRESS_VERIFY_TIMEOUT=100000

increase cypress verification timeout using env var

If you are on Windows and use CMD, use the following command instead.

cmd
# Windows CMD set CYPRESS_VERIFY_TIMEOUT=100000

If you are on Windows and use PowerShell, use the following command instead.

PowerShell
# Windows PowerShell $env:CYPRESS_VERIFY_TIMEOUT=100000

The command sets the verification timeout to 100000 milliseconds (100 seconds).

After you increase the verification timeout to 100 seconds, issue the npx cypress verify command.

shell
npx cypress verify

issue cypress verify command

If the issue persists, try to relaunch Cypress by issuing the cypress run or cypress open command once again.

# Setting the environment variable in your package.json file

Another thing you can try is to set the environment variable in your package.json file, immediately before issuing cypress open or cypress run.

Open your terminal and install the cross-env package.

shell
# 👇️ with NPM npm install cross-env # 👇️ with YARN yarn add cross-env

Now set the CYPRESS_VERIFY_TIMEOUT environment variable in your NPM script, right before issuing the cypress command.

package.json
{ "scripts": { "cypress": "cross-env CYPRESS_VERIFY_TIMEOUT=100000 && cypress run --e2e", "cypress:open": "cross-env CYPRESS_VERIFY_TIMEOUT=100000 && cypress open --e2e" } }

Now you should be able to run the cypress and cypress:open commands without getting a verification timeout.

# Clean your NPM cache

If you still get the error, try to clean your NPM cache.

shell
npm cache clean --force

clear npm cache

Try to rerun the cypress run or cypress open command after clearing your cache.

After you've increased your verification timeout sufficiently, the error should be resolved.

# Additional Resources

You can learn more about the related topics by checking out the following tutorials:

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.