bjowes / cypress-ntlm-auth

Windows authentication plugin for Cypress
MIT License
55 stars 9 forks source link

Getting dependency error as Cannot find module node:tls #198

Closed Gayathri-Kesavakannan closed 2 years ago

Gayathri-Kesavakannan commented 2 years ago

Cypress - 7.5 Installed Cypress-ntlm -auto 3.2.6

Updated index.is in both support and plugin When I try npx cypress-ntlm run am getting error as "Cannot find module 'node:tls' Also http-mint-proxy folder is not created

Tried even setting Node_TLS_REJECT_UNAUTHORIZED=0 but still getting same error. Not sure what dependency am missing here

Thanks Gayathri

bjowes commented 2 years ago

What version of Node.js are you using? The current version of the plugin requires >= 14.13.1

MSIH commented 2 years ago

We just started getting the same error. This has been working for months. We are running "Node.js v15.11.0." on Windows 2016 server. The package.json :

"devDependencies": {
    "cypress": "^6.2.0",
    "cypress-multi-reporters": "^1.4.0",
    "cypress-ntlm-auth": "^3.1.3",

But the version in "".\node_modules\cypress-ntlm-auth\dist" is 3.2.3

{
  "name": "cypress-ntlm-auth",
  "version": "3.2.3",

here is the error. Note "tunnel.agent.js" does not exists in the folder ".\node_modules\cypress-ntlm-auth\dist\proxy"

node:internal/modules/cjs/loader:927
  throw err;
  ^

Error: Cannot find module 'node:tls'
Require stack:
- D:\Program Files (x86)\Jenkins\workspace\Cypress NICHD Prod\node_modules\cypress-ntlm-auth\dist\proxy\tunnel.agent.js
- D:\Program Files (x86)\Jenkins\workspace\Cypress NICHD Prod\node_modules\cypress-ntlm-auth\dist\proxy\connection.context.manager.js
- D:\Program Files (x86)\Jenkins\workspace\Cypress NICHD Prod\node_modules\cypress-ntlm-auth\dist\proxy\dependency.injection.js
- D:\Program Files (x86)\Jenkins\workspace\Cypress NICHD Prod\node_modules\cypress-ntlm-auth\dist\index.js
- D:\Program Files (x86)\Jenkins\workspace\Cypress NICHD Prod\node_modules\cypress-ntlm-auth\dist\launchers\cypress.ntlm.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27)
    at Module.require (node:internal/modules/cjs/loader:996:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (D:\Program Files (x86)\Jenkins\workspace\Cypress NICHD Prod\node_modules\cypress-ntlm-auth\dist\proxy\tunnel.agent.js:7:36)
    at Module._compile (node:internal/modules/cjs/loader:1092:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
    at Module.load (node:internal/modules/cjs/loader:972:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:996:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'D:\\Program Files (x86)\\Jenkins\\workspace\\Cypress NICHD Prod\\node_modules\\cypress-ntlm-auth\\dist\\proxy\\tunnel.agent.js',
    'D:\\Program Files (x86)\\Jenkins\\workspace\\Cypress NICHD Prod\\node_modules\\cypress-ntlm-auth\\dist\\proxy\\connection.context.manager.js',
    'D:\\Program Files (x86)\\Jenkins\\workspace\\Cypress NICHD Prod\\node_modules\\cypress-ntlm-auth\\dist\\proxy\\dependency.injection.js',
    'D:\\Program Files (x86)\\Jenkins\\workspace\\Cypress NICHD Prod\\node_modules\\cypress-ntlm-auth\\dist\\index.js',
    'D:\\Program Files (x86)\\Jenkins\\workspace\\Cypress NICHD Prod\\node_modules\\cypress-ntlm-auth\\dist\\launchers\\cypress.ntlm.js'
  ]
}
MSIH commented 2 years ago

I updated to the latest version of Node.js v16.14.0 and now working.

rlking1985 commented 2 years ago

Getting the same issue with node v14.17.0. Upgrading to 16.14.2 resolved the issue.

rlking1985 commented 2 years ago

@bjowes

Do you have any suggestions on how to get this working in ^14.13.1. Upgrading to ^16.0.0 does work but not something I can do with the project just yet.

It has been working previously so not sure why it stopped.

Any assistance is appreciated

"cypress-ntlm-auth": "^3.2.5",

> npx cypress-ntlm open

internal/modules/cjs/loader.js:888
  throw err;
  ^

Error: Cannot find module 'node:tls'
Require stack:
- C:\Users\KPC\Documents\git\mecrb-react\node_modules\cypress-ntlm-auth\dist\proxy\tunnel.agent.js
- C:\Users\KPC\Documents\git\mecrb-react\node_modules\cypress-ntlm-auth\dist\proxy\connection.context.manager.js
- C:\Users\KPC\Documents\git\mecrb-react\node_modules\cypress-ntlm-auth\dist\proxy\dependency.injection.js
- C:\Users\KPC\Documents\git\mecrb-react\node_modules\cypress-ntlm-auth\dist\index.js
- C:\Users\KPC\Documents\git\mecrb-react\node_modules\cypress-ntlm-auth\dist\launchers\cypress.ntlm.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
    at Function.Module._load (internal/modules/cjs/loader.js:730:27)
    at Module.require (internal/modules/cjs/loader.js:957:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (C:\Users\KPC\Documents\git\mecrb-react\node_modules\cypress-ntlm-auth\dist\proxy\tunnel.agent.js:7:36)
    at Module._compile (internal/modules/cjs/loader.js:1068:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:933:32)
    at Function.Module._load (internal/modules/cjs/loader.js:774:14)
    at Module.require (internal/modules/cjs/loader.js:957:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\KPC\\Documents\\git\\mecrb-react\\node_modules\\cypress-ntlm-auth\\dist\\proxy\\tunnel.agent.js',
    'C:\\Users\\KPC\\Documents\\git\\mecrb-react\\node_modules\\cypress-ntlm-auth\\dist\\proxy\\connection.context.manager.js',
    'C:\\Users\\KPC\\Documents\\git\\mecrb-react\\node_modules\\cypress-ntlm-auth\\dist\\proxy\\dependency.injection.js',
    'C:\\Users\\KPC\\Documents\\git\\mecrb-react\\node_modules\\cypress-ntlm-auth\\dist\\index.js',
    'C:\\Users\\KPC\\Documents\\git\\mecrb-react\\node_modules\\cypress-ntlm-auth\\dist\\launchers\\cypress.ntlm.js'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mecrb-react@2.0.2 cypress: `npx cypress-ntlm open`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mecrb-react@2.0.2 cypress script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\KPC\AppData\Roaming\npm-cache\_logs\2022-03-27T09_08_06_798Z-debug.log
rlking1985 commented 2 years ago

@bjowes

No need to look into it. Version 2.3.2 was the last version that I think supported Node 14. I've reverted back and is working again.

bjowes commented 2 years ago

To resolve, upgrade node. If that isn't possible, downgrade the plugin.

Thanks @rlking1985 for clarifying that 14.13.1 does not work. I'll try getting that sorted for the next release.