cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
47.07k stars 3.19k forks source link

shared memfd open() failed: Function not implemented | trying to run cypress in WSL #4145

Closed pandasanjay closed 1 year ago

pandasanjay commented 5 years ago

Current behavior:

I am using WSL as my development env. Now when I am trying to run Cypress . This gives me shared memfd open() failed: Function not implemented

Steps to reproduce: (app code and test code)

./node_modules/.bin/cypress open
o/p- shared memfd open() failed: Function not implemented

Versions

Distributor ID: Ubuntu Description: Ubuntu 18.04.2 LTS Release: 18.04 Codename: bionic

Is this a issue with cypress?

jennifer-shehane commented 5 years ago

We haven't seen this issue before.

I suggest you try the troubleshooting tips from WSL: https://docs.microsoft.com/en-us/windows/wsl/troubleshooting

Could you run Cypress in debug mode mode and print the logs here also?

pandasanjay commented 5 years ago

Hi @jennifer-shehane

Here is the debugged o/p below DEBUG=cypress:* ./node_modules/.bin/cypress open

  cypress:cli cli starts with arguments ["/usr/bin/node","/mnt/c/Users/panda/workspace/gca-admin/node_modules/cypress/bin/cypress","open"] +0ms
  cypress:cli NODE_OPTIONS is not set +0ms
  cypress:cli program parsing arguments +3ms
  cypress:cli opening Cypress +1ms
  cypress:cli parsed cli options {} +700ms
  cypress:cli opening from options {"project":"/mnt/c/Users/panda/workspace/gca-admin"} +0ms
  cypress:cli command line arguments ["--project","/mnt/c/Users/panda/workspace/gca-admin"] +0ms
  cypress:cli verifying Cypress app +0ms
  cypress:cli checking environment variables +1ms
  cypress:cli checking if executable exists /home/panda/.cache/Cypress/3.2.0/Cypress/Cypress +17ms
  cypress:cli Binary is executable? : true +6ms
  cypress:cli binaryDir is  /home/panda/.cache/Cypress/3.2.0/Cypress +0ms
  cypress:cli Reading binary package.json from: /home/panda/.cache/Cypress/3.2.0/Cypress/resources/app/package.json +0ms
  cypress:cli Found binary version 3.2.0 installed in: /home/panda/.cache/Cypress/3.2.0/Cypress +5ms
  cypress:cli { verified: true } +6ms
  cypress:cli is Verified ? true +4ms
  cypress:cli needs XVFB? true +0ms
  cypress:cli Starting XVFB +0ms
  cypress:cli spawning Cypress with executable: /home/panda/.cache/Cypress/3.2.0/Cypress/Cypress +248ms
  cypress:cli spawn forcing env overrides { FORCE_COLOR: '1', DEBUG_COLORS: '1', MOCHA_COLORS: '1', FORCE_STDIN_TTY: '1', FORCE_STDOUT_TTY: '1', FORCE_STDERR_TTY: '1' } +0ms
  cypress:cli spawn args [ '--project', '/mnt/c/Users/panda/workspace/gca-admin', '--cwd', '/mnt/c/Users/panda/workspace/gca-admin' ] { dev: undefined, detached: false, stdio: 'inherit' } +2ms
  cypress:ts Running without ts-node hook in environment "production" +0ms
  cypress:server:cypress starting cypress with argv [ '/home/panda/.cache/Cypress/3.2.0/Cypress/Cypress', '--project', '/mnt/c/Users/panda/workspace/gca-admin', '--cwd', '/mnt/c/Users/panda/workspace/gca-admin' ] +0ms
  cypress:server:args argv array: [ 
    '/home/panda/.cache/Cypress/3.2.0/Cypress/Cypress', 
    '--project', '/mnt/c/Users/panda/workspace/gca-admin', 
    '--cwd', '/mnt/c/Users/panda/workspace/gca-admin' 
  ] +3s
  cypress:server:args argv parsed: { _: [ 
    '/home/panda/.cache/Cypress/3.2.0/Cypress/Cypress' ], 
    project: '/mnt/c/Users/panda/workspace/gca-admin', 
    cwd: '/mnt/c/Users/panda/workspace/gca-admin' 
  } +5ms
  cypress:server:args argv options: { _: [ 
    '/home/panda/.cache/Cypress/3.2.0/Cypress/Cypress' 
  ], 
  project: '/mnt/c/Users/panda/workspace/gca-admin', 
  cwd: '/mnt/c/Users/panda/workspace/gca-admin', 
  config: {}, 
  projectRoot: '/mnt/c/Users/panda/workspace/gca-admin' 
  } +1ms

**shared memfd open() failed: Function not implemented**

  cypress:server:appdata path: /home/panda/.config/Cypress/cy/production +1s
  cypress:server:cypress starting in mode interactive +15ms
  cypress:server:appdata path: /home/panda/.config/Cypress/cy/production +4s
  cypress:server:appdata path: /home/panda/.config/Cypress/cy/production/cache +17ms
  cypress:server:appdata path: /home/panda/.config/Cypress/cy/production/browsers +26s
  cypress:server:timers queuing timer id 1 after 500 ms +51ms
  cypress:server:timers child received timer id 1 +0ms
  cypress:server:timers child sending timer id 1 +505ms
  cypress:server:timers clearing timer id 1 from queue { '1': { args: [], ms: 500, cb: [Function] } } +510ms
  cypress:server:saved_state making saved state from /home/panda/.cache/Cypress/3.2.0/Cypress/resources/app/packages/server +6ms
  cypress:server:saved_state for project path /mnt/c/Users/panda/workspace/gca-admin +1ms
  cypress:server:saved_state state path for project /mnt/c/Users/panda/workspace/gca-admin +2ms
  cypress:server:appdata path: /home/panda/.config/Cypress/cy/production/projects/gca-admin-302fb8fc469922df75cbe90233a955aa/state.json +1ms
  cypress:server:saved_state full state path /home/panda/.config/Cypress/cy/production/projects/gca-admin-302fb8fc469922df75cbe90233a955aa/state.json +1ms
  cypress:server:saved_state making new state file around /home/panda/.config/Cypress/cy/production/projects/gca-admin-302fb8fc469922df75cbe90233a955aa/state.json +0ms
  cypress:server:file get values from /home/panda/.config/Cypress/cy/production/projects/gca-admin-302fb8fc469922df75cbe90233a955aa/state.json +1ms
  cypress:server:file attempt to get lock on /home/panda/.config/Cypress/cy/production/projects/gca-admin-302fb8fc469922df75cbe90233a955aa/state.json +1ms
  cypress:server:file gettin lock succeeded or failed for /home/panda/.config/Cypress/cy/production/projects/gca-admin-302fb8fc469922df75cbe90233a955aa/state.json +4ms
  cypress:server:file read /home/panda/.config/Cypress/cy/production/projects/gca-admin-302fb8fc469922df75cbe90233a955aa/state.json +1ms
  cypress:server:file read succeeded or failed for /home/panda/.config/Cypress/cy/production/projects/gca-admin-302fb8fc469922df75cbe90233a955aa/state.json +3ms
  cypress:server:file attempt to unlock /home/panda/.config/Cypress/cy/production/projects/gca-admin-302fb8fc469922df75cbe90233a955aa/state.json +0ms
  cypress:server:timers queuing timer id 2 after 2000 ms +1ms
  cypress:server:timers child received timer id 2 +25ms
  cypress:server:timers clearing timer id 2 from queue { '2': { args: [], ms: 2000, cb: [Function: timeoutTimeout] } } +2ms
  cypress:server:file unlock succeeded or failed for /home/panda/.config/Cypress/cy/production/projects/gca-admin-302fb8fc469922df75cbe90233a955aa/state.json +0ms
  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, frame: true, transparent: false, icon: NativeImage {}, url: 'file:///home/panda/.cache/Cypress/3.2.0/Cypress/resources/app/packages/desktop-gui/dist/index.html', webPreferences: { preload: '/home/panda/.cache/Cypress/3.2.0/Cypress/resources/app/packages/server/lib/ipc/ipc.js', partition: null, chromeWebSecurity: true, nodeIntegration: false, backgroundThrottling: false, backgroundColor: '#dfe2e4', transparent: false }, contextMenu: false, recordFrameRate: null, onPaint: null, onCrashed: [Function: onCrashed], onNewWindow: [Function: onNewWindow] } +163ms
  cypress:server:timers child sending timer id 2 +2s
pandasanjay commented 5 years ago

Hi @jennifer-shehane

Any finding with this issue? Please let me know anything extra you need..

jennifer-shehane commented 5 years ago

No, I don't know what is causing this error. Seems isolated to WSL.

justin-bits commented 5 years ago

@pandasanjay, I'm having the same issue. Were you able to find a workaround?

pandasanjay commented 5 years ago

@justin-bits WSL 1 I didn't find the solution yet.

With WSL 2 you can run Headless mode without any issue. I think we can run the Cypress open also, but might need some env config.

https://docs.microsoft.com/en-us/windows/wsl/wsl2-install

justin-bits commented 5 years ago

Thanks for the tip, but I wasn't able to get Cypress open working under WSL 2. It starts without error, but the GUI never opens. It looks like Cypress does not support running under Windows WSL / Ubuntu.

This will prevent me from testing against local builds (which natively run on Linux and won't build on Windows without WSL).

tgelu commented 5 years ago

+1

DanielStoica85 commented 5 years ago

Just ran into the same issue. Is there any solution for this?

justin-bits commented 5 years ago

I ended up abandoning trying to get WSL to work and ended up running application builds and Cypress in Git Bash after changing the shell: npm config set script-shell "C:/Program Files/git/bin/bash.exe".

pandasanjay commented 5 years ago

Finally I found a way which working awesome without any issue in WSL2!

First we have to setup X server (Which is a Desktop like environment) for WSL2. Follow this post please : Xserver setup in WSL2

Then try to run cypress and you will see the UI is working.

tomcanham commented 4 years ago

@pandasanjay I'm still having no luck. In fact, here's a ss of getting the same error IN XFCE4 under WSL2:

image

Anyone else gone down this road? Or is headed Cypress just not going to work under WSL? If so, Cypress folks, this is a bit of a showstopper; there are more devs than you might think working under WSL(2) these days -- just FYI.

tomcanham commented 4 years ago

Looks like this is probably the root cause: https://github.com/microsoft/WSL/issues/3542

tomcanham commented 4 years ago

Resolved: for me, it was a no-brainer. Although I had WSL2 installed, I hadn't set it as the default subsystem. So when I (re)installed Debian, it used WSL1. Switching to WSL2 (and running under xfce/firefox) worked. So make sure to do a wsl -l -v and make sure you're running under WSL2 if you want a UI :)

dcharlespyle commented 4 years ago

I see the exact same error running Pale Moon browser on WSL1, when a video is run using it.

image

This would suggest that WSL1 is involved, as it uses an emulated kernel, unlike WSL2, which uses a real Linux kernel. Best to use WSL2 if you don't want to see this error message with any application used in an emulated Linux environment, and this would include use of cypress-io.

cypress-app-bot commented 1 year ago

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

cypress-app-bot commented 1 year ago

This issue has been closed due to inactivity.