Skip to content

Commit d2779f6

Browse files
authored
Update Run Cypress by itself (#5954)
1 parent 98bc5f0 commit d2779f6

File tree

1 file changed

+94
-52
lines changed

1 file changed

+94
-52
lines changed

docs/guides/references/troubleshooting.mdx

Lines changed: 94 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -534,88 +534,130 @@ Some common situations on why you would want to run Cypress by itself are to:
534534
module
535535
536536
Here is how you can launch Cypress directly without the npm CLI module. First,
537-
find where the binary is installed using the
538-
[cypress cache path](/guides/guides/command-line#cypress-cache-path) command.
537+
find where Cypress binary versions are installed using the
538+
[cypress cache path](/guides/guides/command-line#cypress-cache-path) and
539+
[cypress cache list](/guides/guides/command-line#cypress-cache-list) commands.
539540
540-
For example, on a Linux machine:
541+
An example on a Linux machine shows:
541542
542-
```shell
543-
npx cypress cache path
544-
/root/.cache/Cypress
543+
```text
544+
$ npx cypress cache path
545+
/home/<username>/.cache/Cypress
546+
$ npx cypress cache list
545547
```
546548
549+
| version | last used |
550+
| ------- | ----------- |
551+
| 13.15.0 | 12 days ago |
552+
553+
You can replace the Linux `/home/<username>` directory with the `~` character in the following example steps.
554+
547555
Second, try a smoke test that verifies that the application has all its required
548-
dependencies present on the host machine:
556+
dependencies present on the host machine. Ignore the warning about running the Cypress binary directly.
549557
550-
```shell
551-
/root/.cache/Cypress/3.3.1/Cypress/Cypress --smoke-test --ping=101
552-
101
553-
```
558+
```text
559+
$ ~/.cache/Cypress/13.15.0/Cypress/Cypress --smoke-test --ping=101
554560

555-
If there is a missing dependency, the application should print an error message.
556-
You can see the Electron verbose log messages by setting an
557-
[environment variable ELECTRON_ENABLE_LOGGING](https://www.electronjs.org/docs/api/command-line-switches):
561+
DevTools listening on ws://127.0.0.1:39737/devtools/browser/162ad33c-294b-460b-812e-cc317907ac86
562+
It looks like you are running the Cypress binary directly.
558563

559-
```shell
560-
ELECTRON_ENABLE_LOGGING=true DISPLAY=10.130.4.201:0 /root/.cache/Cypress/3.3.1/Cypress/Cypress --smoke-test --ping=101
561-
[809:0617/151243.281369:ERROR:bus.cc(395)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
564+
This is not the recommended approach, and Cypress may not work correctly.
565+
566+
Please install the cypress NPM package and follow the instructions here:
567+
568+
https://on.cypress.io/installing-cypress
562569
101
563570
```
564571
565-
If the smoke test fails to execute, check if a shared library is missing (a
566-
common problem on Linux machines without all of the Cypress dependencies
567-
present).
572+
If there is a missing dependency, the smoke test will fail to run and the application will print an error message
573+
referring to [Linux Prerequisites](../getting-started/installing-cypress#Linux-Prerequisites).
574+
Follow the instructions to ensure all required dependencies are installed.
568575
569-
```shell
570-
ldd /home/person/.cache/Cypress/3.3.1/Cypress/Cypress
571-
linux-vdso.so.1 (0x00007ffe9eda0000)
572-
libnode.so => /home/person/.cache/Cypress/3.3.1/Cypress/libnode.so (0x00007fecb43c8000)
573-
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fecb41ab000)
574-
libgtk-3.so.0 => not found
575-
libgdk-3.so.0 => not found
576+
To troubleshoot missing shared library dependencies on Linux, use the `ldd` command on the Cypress binary.
577+
A missing dependency should be identified with "not found" in the output.
578+
579+
```text
580+
ldd ~/.cache/Cypress/13.15.0/Cypress/Cypress
581+
linux-vdso.so.1 (0x00007ffe0e7db000)
582+
libffmpeg.so => /home/<username>/.cache/Cypress/13.15.0/Cypress/libffmpeg.so (0x0000774bc7a00000)
583+
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x0000774bd26d0000)
584+
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x0000774bd26cb000)
585+
libgobject-2.0.so.0 => /lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x0000774bd2668000)
586+
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x0000774bd251f000)
587+
libgio-2.0.so.0 => /lib/x86_64-linux-gnu/libgio-2.0.so.0 (0x0000774bc7e30000)
588+
libnss3.so => not found
576589
...
577590
```
578591
579-
**Tip:** use [Cypress Docker image](/examples/docker) or install dependencies by
580-
copying them from one of our official Docker images.
592+
**Tip:** If you are having problems with dependencies, use a [Cypress Docker image](../getting-started/installing-cypress#Docker-Prerequisites). These have all Cypress dependencies pre-installed.
593+
594+
On Ubuntu `24.04` you may receive a fatal error including the text `FATAL:setuid_sandbox_host.cc` due to added security in this version of Ubuntu.
595+
Refer to the [Ubuntu 24.04 Release notes](https://discourse.ubuntu.com/t/noble-numbat-release-notes/39890) in the section [Unprivileged user namespace restrictions](https://discourse.ubuntu.com/t/noble-numbat-release-notes/39890#unprivileged-user-namespace-restrictions-15) and apply one of the workarounds to disable unprivileged user namespace restrictions for the entire system, either for one boot or persistently, as described.
596+
597+
Alternatively you can follow the instructions in the error message similar to:
581598
582-
**Note:** verbose Electron logging might show warnings that still allow Cypress
583-
to work normally. For example, Cypress opens normally despite the scary output
584-
below:
599+
> You need to make sure that `/home/<username>/.cache/Cypress/13.15.0/Cypress/chrome-sandbox` is owned by root and has mode 4755.
600+
601+
and execute for example:
585602
586603
```shell
587-
ELECTRON_ENABLE_LOGGING=true DISPLAY=10.130.4.201:0 /root/.cache/Cypress/3.3.1/Cypress/Cypress
588-
[475:0617/150421.326986:ERROR:bus.cc(395)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
589-
[475:0617/150425.061526:ERROR:bus.cc(395)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
590-
[475:0617/150425.079819:ERROR:bus.cc(395)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
591-
[475:0617/150425.371013:INFO:CONSOLE(73292)] "%cDownload the React DevTools for a better development experience: https://fb.me/react-devtools
592-
You might need to use a local HTTP server (instead of file://): https://fb.me/react-devtools-faq", source: file:///root/.cache/Cypress/3.3.1/Cypress/resources/app/packages/desktop-gui/dist/app.js (73292)
604+
sudo chown root:root ~/.cache/Cypress/13.15.0/Cypress/chrome-sandbox
605+
sudo chmod +4755 ~/.cache/Cypress/13.15.0/Cypress/chrome-sandbox
593606
```
594607
595-
You can also see verbose Cypress logs when running the Cypress binary
608+
You can see the Electron verbose log messages by setting an
609+
[environment variable ELECTRON_ENABLE_LOGGING](https://www.electronjs.org/docs/api/command-line-switches).
596610
597-
```shell
598-
DEBUG=cypress* DISPLAY=10.130.4.201:0 /root/.cache/Cypress/3.3.1/Cypress/Cypress --smoke-test --ping=101
599-
cypress:ts Running without ts-node hook in environment "production" +0ms
600-
cypress:server:cypress starting cypress with argv [ '/root/.cache/Cypress/3.3.1/Cypress/Cypress', '--smoke-test', '--ping=101' ] +0ms
601-
cypress:server:args argv array: [ '/root/.cache/Cypress/3.3.1/Cypress/Cypress', '--smoke-test', '--ping=101' ] +0ms
602-
cypress:server:args argv parsed: { _: [ '/root/.cache/Cypress/3.3.1/Cypress/Cypress' ], smokeTest: true, ping: 101, cwd: '/root/.cache/Cypress/3.3.1/Cypress/resources/app/packages/server' } +7ms
603-
cypress:server:args options { _: [ '/root/.cache/Cypress/3.3.1/Cypress/Cypress' ], smokeTest: true, ping: 101, cwd: '/root/.cache/Cypress/3.3.1/Cypress/resources/app/packages/server', config: {} } +2ms
604-
cypress:server:args argv options: { _: [ '/root/.cache/Cypress/3.3.1/Cypress/Cypress' ], smokeTest: true, ping: 101, cwd: '/root/.cache/Cypress/3.3.1/Cypress/resources/app/packages/server', config: {}, pong: 101 } +1ms
605-
cypress:server:appdata path: /root/.config/Cypress/cy/production +0ms
606-
cypress:server:cypress starting in mode smokeTest +356ms
611+
**Note:** Verbose Electron logging might show warnings that still allow Cypress
612+
to work normally. For example, the following Bluetooth related warning can be ignored:
613+
614+
> WARNING:bluez_dbus_manager.cc
615+
616+
```text
617+
ELECTRON_ENABLE_LOGGING=true ~/.cache/Cypress/13.15.0/Cypress/Cypress --smoke-test --ping=101
618+
619+
DevTools listening on ws://127.0.0.1:33161/devtools/browser/1f8a2d15-ea42-403f-8eb4-757f1a9d0b25
620+
[3959:1005/201139.970068:WARNING:bluez_dbus_manager.cc(247)] Floss manager not present, cannot set Floss enable/disable.
621+
It looks like you are running the Cypress binary directly.
622+
623+
This is not the recommended approach, and Cypress may not work correctly.
624+
625+
Please install the cypress NPM package and follow the instructions here:
626+
627+
https://on.cypress.io/installing-cypress
628+
101
629+
```
630+
631+
You can also see Cypress debug logs by setting an
632+
[environment variable `DEBUG=cypress:*`](#Print-DEBUG-logs).
633+
634+
```text
635+
$ DEBUG=cypress:* ~/.cache/Cypress/13.15.0/Cypress/Cypress --smoke-test --ping=101
636+
cypress:snapshot:info Caching 3374, defining 4217 modules! Using cache +0ms
637+
cypress:snapshot:debug initializing packherd require +0ms
638+
cypress:server:performance-benchmark elapsed time at v8-snapshot-startup-time: 204.65ms +0ms
639+
cypress:server:appdata path: /home/<username>/.config/Cypress/cy/production/browsers +0ms
640+
cypress:server appending default switches for electron: [
641+
cypress:server { name: '--test-type' },
642+
...
643+
cypress:server { name: '--enable-precise-memory-info' }
644+
cypress:server ] +0ms
645+
cypress:server:cypress starting cypress with argv [ '/home/<username>/.cache/Cypress/13.15.0/Cypress/Cypress', '--smoke-test', '--ping=101' ] +0ms
646+
...
647+
cypress:server:cypress running Electron currently +13ms
607648
101
608-
cypress:server:cypress about to exit with code 0 +4ms
649+
cypress:server:cypress about to exit with code 0 +18ms
650+
cypress:server:browsers browsers.kill called with no active instance +0ms
609651
```
610652
611-
If the smoke test does not show a specific error yet fails, try printing the
653+
If the smoke test does not show a specific error yet crashes, try printing the
612654
Electron crash stack to maybe pinpoint the problem better:
613655
614656
```shell
615657
ELECTRON_ENABLE_STACK_DUMPING=1 npx cypress verify
616658
...
617659
Received signal 11 SEGV_MAPERR ffffffb27e8955bb
618-
#0 0x55c6389f83d9 (/root/.cache/Cypress/3.8.2/Cypress/Cypress+0x35d13d8)
660+
#0 0x55c6389f83d9 (/home/<username>/.cache/Cypress/13.15.0/Cypress/Cypress+0x35d13d8)
619661
r8: 0000000000000000 r9: 00007ffcf0387c80 r10: 00007ffcf0387bd8 r11: 000000000000000e
620662
r12: 00007ffcf0387d2c r13: 00007f3ea737b720 r14: ffffffb27e89558b r15: 00007f3ea8974200
621663
di: 0000000000000000 si: 0000000000000020 bp: 0000000000000000 bx: 0000004f2f375580

0 commit comments

Comments
 (0)