cypress icon indicating copy to clipboard operation
cypress copied to clipboard

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

Open TheDutchCoder opened this issue 3 years ago • 36 comments

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

TheDutchCoder avatar Dec 03 '21 13:12 TheDutchCoder

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

eqje avatar Dec 09 '21 07:12 eqje

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.

TheDutchCoder avatar Dec 11 '21 13:12 TheDutchCoder

Same for me.

Cypress Version

  • Cypress 9.1.1.

Other

  • MacOS 11.6
  • Node v14.17.3

Running under VSCode.

  • Version: 1.63.0 (Universal)

dfdumaresq avatar Dec 21 '21 00:12 dfdumaresq

Same for me too

Ubuntu (virtualBox) VS CODE

Karine-Bauch avatar Jan 11 '22 12:01 Karine-Bauch

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.

russellpekala avatar Jan 13 '22 18:01 russellpekala

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

dfdumaresq avatar Jan 13 '22 18:01 dfdumaresq

I am using yarn pnp .. encounter this issue

zigang93 avatar Jan 21 '22 09:01 zigang93

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.

riboher avatar Jan 24 '22 12:01 riboher

I have the same error messages but everything still runs.

geoyws avatar Jan 27 '22 06:01 geoyws

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

dbubenheim avatar Jan 27 '22 07:01 dbubenheim

I had the same warning

revert to cypress 9.2.0 seem to solve this,

npm install [email protected]

linediconsine avatar Jan 28 '22 15:01 linediconsine

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.

giorgio-zamparelli avatar Mar 03 '22 09:03 giorgio-zamparelli

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.

ericblade avatar Mar 09 '22 03:03 ericblade

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?

david-d-an avatar Apr 20 '22 17:04 david-d-an

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

CallumHoward avatar Apr 20 '22 23:04 CallumHoward

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

david-d-an avatar Apr 20 '22 23:04 david-d-an

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.

apaatsio avatar May 04 '22 14:05 apaatsio

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.

vinayg-cp avatar May 12 '22 09:05 vinayg-cp

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 🤷🏻

wmadden avatar Jun 15 '22 17:06 wmadden

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

mehrshadFarzaneh avatar Sep 20 '22 15:09 mehrshadFarzaneh

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.

lmiller1990 avatar Apr 07 '23 00:04 lmiller1990

i have this same problem used docker and vite

radthenone avatar Apr 24 '23 15:04 radthenone

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

MikeMcC399 avatar May 05 '23 08:05 MikeMcC399

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)?

lmiller1990 avatar May 08 '23 00:05 lmiller1990

@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.

MikeMcC399 avatar May 08 '23 04:05 MikeMcC399

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:

  • remove nodemon from dev dependecies.(npm uninstall -D nodemon)
  • install it as global package (npm install -g nodemon)
  • change "runtimeExecutable": "${workspaceFolder}/node_modules/nodemon/bin/nodemon.js", to "runtimeExecutable": "nodemon",

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.

AlexPandovich avatar May 16 '23 16:05 AlexPandovich

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

  • So I changed the version manually to "cypress": "^9.2.0" (according to https://github.com/cypress-io/cypress/issues/19229#issuecomment-1024321701),
  • then yarn install
  • change it back to "^12.17.2", then yarn install

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

safydy avatar Jul 26 '23 16:07 safydy

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)

AStoker avatar Sep 21 '23 15:09 AStoker

@AStoker

  • It seems your issue is related to https://github.com/cypress-io/cypress/issues/27450

MikeMcC399 avatar Sep 21 '23 15:09 MikeMcC399

Still happening with the latest version.

TheDirigible avatar Feb 03 '24 00:02 TheDirigible