cypress-io / cypress

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

"Most NODE_OPTIONs are not supported in packaged apps" when running cypress component testing #19229

Open TheDutchCoder opened 2 years ago

TheDutchCoder commented 2 years ago

Current behavior

When I run npm run cypress:open-ct (or run-ct), I get an error [43901:1203/085557.424470:ERROR:node_bindings.cc(276)] Most NODE_OPTIONs are not supported in packaged apps. See documentation for more details.

This might be an Electron issue and it doesn't seem to affect behaviour for us.

Desired behavior

No error to be thrown

Test code to reproduce

Run the Cypress component tester

Cypress Version

9.1.0

Other

MacOS 11.6 Node v16.0.0

eqje commented 2 years ago

Hi @TheDutchCoder We have same problem actually - did you solve this already?

TheDutchCoder commented 2 years ago

It's still showing up, but I'm not sure if there's a newer version, will check that later.

We also get an "app quit unexpectedly" warning whenever we close Cypress.

dfdumaresq commented 2 years ago

Same for me.

Cypress Version

Other

Running under VSCode.

Karine-Bauch commented 2 years ago

Same for me too

Ubuntu (virtualBox) VS CODE

russellpekala commented 2 years ago

Same here.

Cypress 9.2.1 Mac M1 latest

It seems to have affected cypress testing only on first open after clean install for me.

dfdumaresq commented 2 years ago

From my limited experience it doesn't seem to affect Cypress testing.

zigang93 commented 2 years ago

I am using yarn pnp .. encounter this issue

riboher commented 2 years ago

Same thing as @zigang93. Using yarn PnP, all of a sudden I can't init cypress whatsoever. Trying to open the desktop app is unsuccessful, seeing the same error discussed above. When running my tests in headless mode, cypress starts, but it is like no packages have been installed at all, so everything fails.

geoyws commented 2 years ago

I have the same error messages but everything still runs.

dbubenheim commented 2 years ago

Same here. Log statements are showing up, but still the test suite runs fine.

linediconsine commented 2 years ago

I had the same warning

revert to cypress 9.2.0 seem to solve this,

npm install cypress@9.2.0

giorgio-zamparelli commented 2 years ago

For me downgrading to cypress 9.2.0 did not remove the error. Tests are still passing with both 9.2.0 and 9.5.1 with the error.

ericblade commented 2 years ago

9.5.1 reports this to me every time i run it. The first time, it crashed immediately upon printing this message, afterwards it runs fine.

david-d-an commented 2 years ago

I get the error only on M1 Mac but Intel Mac doesn't throw any errors. The same Node version (14.16.1), same code, same packages. Only difference is M1 and Intel chips. Is anyone having trouble on Intel Mac?

CallumHoward commented 2 years ago

@dong82 I'm seeing it on Intel Mac with node 12 (so old, I know).

david-d-an commented 2 years ago

M1 issue was addressed by Cypress themselves. See their article here.

apaatsio commented 2 years ago

The error doesn't seem to affect the test run. But to get rid of it anyway, for me it helped just to unset the environment variable before running cypress.

unset NODE_OPTIONS

FWIW, I'm using cypress 8.6.0 on an Intel Mac.

vinayg-cp commented 2 years ago

The error doesn't seem to affect the test run. But to get rid of it anyway, for me it helped just to unset the environment variable before running cypress.

unset NODE_OPTIONS

FWIW, I'm using cypress 8.6.0 on an Intel Mac.

This worked for me.

wmadden commented 2 years ago

FYI NODE_OPTIONS is set by Yarn to add the PnP module loader to Node when you use yarn exec, so if you're using Yarn PnP you probably shouldn't unset it. Even if you're not using PnP it's probably worth checking what value it's set to 🤷🏻

mehrshadFarzaneh commented 2 years ago

I solved this problem But the point is that I use Angular version 14

I run the commandng e2eto solve this problem Then I selected cypress among the suggested options in the command line

lmiller1990 commented 1 year ago

I am also running into this, I think NODE_OPTIONS is not getting respected (which yarn uses to set the --require for their PnP feature) which is why https://github.com/cypress-io/cypress/issues/25960 is a problem.

I am trying to find out how to fix this. The warning is from Electron: https://www.electronjs.org/docs/latest/api/environment-variables#node_options. Specifically

NODE_OPTIONS are explicitly disallowed in packaged apps, except for the following:

--max-http-header-size
--http-parser

Hmm, wonder if we can make this work somehow.

radthenone commented 1 year ago

i have this same problem used docker and vite

MikeMcC399 commented 1 year ago

This issue also affects Cypress E2E tests using Yarn Modern pnp. It is not restricted to CT.

lmiller1990 commented 1 year ago

Is this causing anyone to be unable to run tests or is mostly a style thing (eg - you don't like seeing a warning, even if it has no impact on you runs)?

MikeMcC399 commented 1 year ago

@lmiller1990

Is this causing anyone to be unable to run tests or is mostly a style thing (eg - you don't like seeing a warning, even if it has no impact on you runs)?

I haven't seen any test impact. The Electron warning always appears with Yarn Plug'n'Play, presumably because Electron is always used in the first phase, even if subsequently another browser is used for tests.

AlexPandovich commented 1 year ago

Hello

I have similar issue with running nodemon as debug configuration for VS code on Windows10 for Node.js by using .vscode/launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "nodemon",
            "runtimeExecutable": "${workspaceFolder}/node_modules/nodemon/bin/nodemon.js",
            "restart": true,
            "console": "integratedTerminal",
            "internalConsoleOptions": "neverOpen"
        }
    ]
}

In my case:

Command line changed from: :${env:NODE_OPTIONS}='--require "c:/Users/38098/AppData/Local/Programs/Microsoft VS Code/resources/app/extensions/ms-vscode.js-debug/src/bootloader.js" --inspect-publish-uid=http'; ${env:VSCODE_INSPECTOR_OPTIONS}='{"inspectorIpc":"\\.\pipe\node-cdp.18452-04647856-1.sock","deferredMode":false,"waitForDebugger":"","execPath":"C:\Program Files\nodejs\node.exe","onlyEntrypoint":false,"autoAttachMode":"always","fileCallback":"C:\Users\38098\AppData\Local\Temp\node-debug-callback-5477a4347fa4ae67"}'; & 'D:\projects\4-nodejs-demo-3/node_modules/nodemon/bin/nodemon.js'

to: ${env:NODE_OPTIONS}='--require "c:/Users/38098/AppData/Local/Programs/Microsoft VS Code/resources/app/extensions/ms-vscode.js-debug/src/bootloader.js" --inspect-publish-uid=http'; ${env:VSCODE_INSPECTOR_OPTIONS}='{"inspectorIpc":"\\.\pipe\node-cdp.7668-3e75cba0-11.sock","deferredMode":false,"waitForDebugger":"","execPath":"C:\Program Files\nodejs\node.exe","onlyEntrypoint":false,"autoAttachMode":"always","fileCallback":"C:\Users\38098\AppData\Local\Temp\node-debug-callback-03f1f420e5a7512e"}'; & 'C:\Users\38098\AppData\Roaming\npm\nodemon.cmd'

And it starts to work.

safydy commented 1 year ago

For my case, I was using "cypress": "^12.17.2",

Nothing has changed on my yarn.lock, but that workaround did resolve my issue. Very strange !!!

AStoker commented 1 year ago

Adding my voice to the group. Experiencing this with latest version of Cypress (^13.0.0). Our setup is using NX to create an single Angular application. We then set up Yarn PnP, and then ran the cypress command to configure component tests (yarn nx g @nx/angular:cypress-component-configuration --project=my-project --build-target=my-projectr:build).

We then get this

[50088:0921/113920.188:ERROR:node_bindings.cc(300)] Most NODE_OPTIONs are not supported in packaged apps. See documentation for more details.

Followed by this

DevTools listening on ws://127.0.0.1:53068/devtools/browser/60158d19-8ee0-4092-bc24-6df5ffca7643
Your configFile is invalid: C:\Projects\***\cypress.config.ts

It threw an error when required, check the stack trace below:

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for C:\Projects\***\cypress.config.ts
    at new NodeError (node:internal/errors:405:5)
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:99:9)
    at defaultGetFormat (node:internal/modules/esm/get_format:142:36)
    at defaultLoad (node:internal/modules/esm/load:91:20)
    at nextLoad (node:internal/modules/esm/hooks:733:28)
    at load$1 (file:///C:/***/.pnp.loader.mjs:1456:12)
    at nextLoad (node:internal/modules/esm/hooks:733:28)
    at Hooks.load (node:internal/modules/esm/hooks:377:26)
    at MessagePort.handleMessage (node:internal/modules/esm/worker:168:24)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:778:20)
MikeMcC399 commented 1 year ago

@AStoker

TheDirigible commented 9 months ago

Still happening with the latest version.

illegalnumbers commented 8 months ago

I also see this on latest

adico1 commented 8 months ago

I also see this on latest

+1

irv-armenta-g commented 4 months ago

+1

alvincrespo commented 2 weeks ago

+1