Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

throw Error(yargs parser supports a minimum Node.js version of ${minNodeVersion} Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`); #3876

Open
Ragunath opened this issue Feb 20, 2024 · 3 comments

Comments

@Ragunath
Copy link

Ragunath commented Feb 20, 2024

I am in Angular 12 version , Node : 14.20.1. We upgraded angular 11 to angular 12 while running npm run test, then we faced this issue. Also, given the package .json below.

I tried changing many node versions even to the latest(20.x) as error described , no luck!

When karma is more than 6 version
i.e "karma": "^6.3.12",
karma-typescript": "~5.5.4",

====ERROR======
C:\Users\Project\node_modules\karma\node_modules\yargs-parser\build\index.cjs:1007
throw Error(yargs parser supports a minimum Node.js version of ${minNodeVersion}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions);
^

Error: yargs parser supports a minimum Node.js version of 10. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions
at Object. (C:\Project\node_modules\karma\node_modules\yargs-parser\build\index.cjs:1007:15)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object. (C:\Project\node_modules\karma\node_modules\yargs\build\index.cjs:2855:16)
at Module._compile (module.js:653:30)
npm ERR! Test failed. See above for more details.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @project@4.1.0 prepublishOnly: npm run build:clean && npm test && npm run build:lib && npm run docs
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @project@4.1.0 prepublishOnly script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

=========
I tried to fix in another angle by changing the versions of karma and its dependency packages. This time we are getting some other issue that can't track it. below are the error.

When karma is less than 5 version
i.e "karma": "5.2.3",
karma-typescript": "^4.1.1

====ERROR======
ERROR [karma-server]: UncaughtException:: Unable to resolve module [set] from [C:/Users/Project/lib.js]
{
"basedir": "C:/Users/project",
"extensions": [
"extensions": [
".js",
".json",
".ts",
".tsx"
],
"moduleDirectory": [
"node_modules"
],
"modules": {
"assert": "C:\Users\Project\\node_modules\karma-typescript\node_modules\assert\build\assert.js",
"buffer": "C:\Users\Project\\node_modules\buffer\index.js",
"child_process": "C:\Users\Project\\node_modules\karma-typescript\dist\bundler\resolve\empty.js",
"cluster": "C:\Users\Project\\node_modules\karma-typescript\dist\bundler\resolve\empty.js",
"console": "C:\Users\Project\\node_modules\console-browserify\index.js",
"constants": "C:\Users\Project\\node_modules\constants-browserify\constants.json",
"crypto": "C:\Users\Project\\node_modules\crypto-browserify\index.js",
"dgram": "C:\Users\Project\\node_modules\karma-typescript\dist\bundler\resolve\empty.js",
"dns": "C:\Users\Project\\node_modules\karma-typescript\dist\bundler\resolve\empty.js",
"domain": "C:\Users\Project\\node_modules\karma-typescript\node_modules\domain-browser\source\index.js",
"events": "C:\Users\Project\\node_modules\karma-typescript\node_modules\events\events.js",
"fs": "C:\Users\Project\\node_modules\karma-typescript\dist\bundler\resolve\empty.js",
"http": "C:\Users\Project\\node_modules\karma-typescript\node_modules\stream-http\index.js",
"https": "C:\Users\Project\\node_modules\https-browserify\index.js",
"module": "C:\Users\Project\\node_modules\karma-typescript\dist\bundler\resolve\empty.js",
"net": "C:\Users\Project\\node_modules\karma-typescript\dist\bundler\resolve\empty.js",
"os": "C:\Users\Project\\node_modules\os-browserify\browser.js",
"path": "C:\Users\Project\\node_modules\karma-typescript\node_modules\path-browserify\index.js",
"punycode": "C:\Users\Project\\node_modules\karma-typescript\node_modules\punycode\punycode.js",
"querystring": "C:\Users\Project\\node_modules\querystring-es3\index.js",
"readline": "C:\Users\Project\\node_modules\karma-typescript\dist\bundler\resolve\empty.js",
"repl": "C:\Users\Project\\node_modules\karma-typescript\dist\bundler\resolve\empty.js",
"stream": "C:\Users\Project\\node_modules\stream-browserify\index.js",
"_stream_duplex": "C:\Users\Project\\node_modules\karma-typescript\node_modules\readable-stream\lib\_stream_duplex.js",
"_stream_passthrough": "C:\Users\Project\\node_modules\karma-typescript\node_modules\readable-stream\lib\_stream_passthrough.js",
"_stream_readable": "C:\Users\Project\\node_modules\karma-typescript\node_modules\readable-stream\lib\_stream_readable.js",
"_stream_transform": "C:\Users\Project\\node_modules\karma-typescript\node_modules\readable-stream\lib\_stream_transform.js",
"_stream_writable": "C:\Users\Project\\node_modules\karma-typescript\node_modules\readable-stream\lib\_stream_writable.js",
"string_decoder": "C:\Users\Project\\node_modules\karma-typescript\node_modules\string_decoder\lib\string_decoder.js",
"sys": "C:\Users\Project\\node_modules\karma-typescript\node_modules\util\util.js",
"timers": "C:\Users\Project\\node_modules\karma-typescript\node_modules\timers-browserify\main.js",
"tls": "C:\Users\Project\\node_modules\karma-typescript\dist\bundler\resolve\empty.js",
"tty": "C:\Users\Project\\node_modules\tty-browserify\index.js",
"url": "C:\Users\Project\\node_modules\url\url.js",
"util": "C:\Users\Project\\node_modules\karma-typescript\node_modules\util\util.js",
"vm": "C:\Users\Project\\node_modules\karma-typescript\node_modules\vm-browserify\index.js",
"zlib": "C:\Users\Project\\node_modules\browserify-zlib\lib\index.js",
"_process": "C:\Users\Project\\node_modules\process\browser.js"
},
"filename": "",
"paths": []
}
Error: Cannot find module 'set' from 'C:/Users/Project'
19 02 2024 13:06:56.945:ERROR [karma-server]: Error: Unable to resolve module [set] from [C:/Users/Project/lib.js]
{
"basedir": "C:/Users/Project",
"extensions": [
".js",
".json",
".ts",
".tsx"
],
"moduleDirectory": [
"node_modules"
],
"modules": {
"assert": "C:\Users\Project\\node_modules\karma-typescript\node_modules\assert\build\assert.js",
"buffer": "C:\Users\Project\\node_modules\buffer\index.js",
"child_process": "C:\Users\Project\\node_modules\karma-typescript\dist\bundler\resolve\empty.js",
"cluster": "C:\Users\Project\\node_modules\karma-typescript\dist\bundler\resolve\empty.js",
"console": "C:\Users\Project\\node_modules\console-browserify\index.js",
"constants": "C:\Users\Project\\node_modules\constants-browserify\constants.json",
"crypto": "C:\Users\Project\\node_modules\crypto-browserify\index.js",
"dgram": "C:\Users\Project\\node_modules\karma-typescript\dist\bundler\resolve\empty.js",
"dns": "C:\Users\Project\\node_modules\karma-typescript\dist\bundler\resolve\empty.js",
"domain": "C:\Users\Project\\node_modules\karma-typescript\node_modules\domain-browser\source\index.js",
"events": "C:\Users\Project\\node_modules\karma-typescript\node_modules\events\events.js",
"fs": "C:\Users\Project\\node_modules\karma-typescript\dist\bundler\resolve\empty.js",
"http": "C:\Users\Project\\node_modules\karma-typescript\node_modules\stream-http\index.js",
"https": "C:\Users\Project\\node_modules\https-browserify\index.js",
"module": "C:\Users\Project\\node_modules\karma-typescript\dist\bundler\resolve\empty.js",
"net": "C:\Users\Project\\node_modules\karma-typescript\dist\bundler\resolve\empty.js",
"os": "C:\Users\Project\\node_modules\os-browserify\browser.js",
"path": "C:\Users\Project\\node_modules\karma-typescript\node_modules\path-browserify\index.js",
"punycode": "C:\Users\Project\\node_modules\karma-typescript\node_modules\punycode\punycode.js",
"querystring": "C:\Users\Project\\node_modules\querystring-es3\index.js",
"readline": "C:\Users\Project\\node_modules\karma-typescript\dist\bundler\resolve\empty.js",
"repl": "C:\Users\Project\\node_modules\karma-typescript\dist\bundler\resolve\empty.js",
"stream": "C:\Users\Project\\node_modules\stream-browserify\index.js",
"_stream_duplex": "C:\Users\Project\\node_modules\karma-typescript\node_modules\readable-stream\lib\_stream_duplex.js",
"_stream_passthrough": "C:\Users\Project\\node_modules\karma-typescript\node_modules\readable-stream\lib\_stream_passthrough.js",
"_stream_readable": "C:\Users\Project\\node_modules\karma-typescript\node_modules\readable-stream\lib\_stream_readable.js",
"_stream_transform": "C:\Users\Project\\node_modules\karma-typescript\node_modules\readable-stream\lib\_stream_transform.js",
"_stream_writable": "C:\Users\Project\\node_modules\karma-typescript\node_modules\readable-stream\lib\_stream_writable.js",
"string_decoder": "C:\Users\Project\\node_modules\karma-typescript\node_modules\string_decoder\lib\string_decoder.js",
"sys": "C:\Users\Project\\node_modules\karma-typescript\node_modules\util\util.js",
"timers": "C:\Users\Project\\node_modules\karma-typescript\node_modules\timers-browserify\main.js",
"tls": "C:\Users\Project\node_modules\karma-typescript\dist\bundler\resolve\empty.js",
"tty": "C:\Users\Project\node_modules\tty-browserify\index.js",
"url": "C:\Users\Project\node_modules\url\url.js",
"util": "C:\Users\Project\node_modules\karma-typescript\node_modules\util\util.js",
"vm": "C:\Users\Project\node_modules\karma-typescript\node_modules\vm-browserify\index.js",
"zlib": "C:\Users\Project\node_modules\browserify-zlib\lib\index.js",
"_process": "C:\Users\Project\node_modules\process\browser.js"
},
"filename": "",
"paths": []
}
Error: Cannot find module 'set' from 'C:/Users/Project'
at C:/Users/Project\node_modules\karma-typescript\dist\bundler\resolve\resolver.js:178:27
at C:/Users/Project\node_modules\browser-resolve\index.js:265:24
at C:/Users/Project\node_modules\browser-resolve\node_modules\resolve\lib\async.js:46:14
at process (C:/Users/Project\node_modules\browser-resolve\node_modules\resolve\lib\async.js:173:43)
at ondir (C:/Users/Project\node_modules\browser-resolve\node_modules\resolve\lib\async.js:188:17)
at load (C:/Users/Project\node_modules\browser-resolve\node_modules\resolve\lib\async.js:69:43)
at onex (C:/Users/Project\node_modules\browser-resolve\node_modules\resolve\lib\async.js:92:31)
at C:/Users/Project\node_modules\browser-resolve\node_modules\resolve\lib\async.js:22:47
at FSReqWrap.oncomplete (fs.js:152:21)
(node:27540) [log4js-node-DEP0004] DeprecationWarning: Pattern %d{DATE} is deprecated due to the confusion it causes when used. Please use %d{DATETIME} instead.
(node:27540) [log4js-node-DEP0004] DeprecationWarning: Pattern %d{DATE} is deprecated due to the confusion it causes when used. Please use %d{DATETIME} instead.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @project test: karma start karma.conf.js --single-run=true
npm ERR! Exit status 1
npm ERR!
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

stuck in this issue for more than 2 weeks, Any solution much appreciated, Thanks in advance.

@adeopura4
Copy link

Were you able to find a resolution to this issue?

@royscheepens
Copy link

I've not been able to find out what causes it, but to prevent the error from throwing you can manually set process.env.YARGS_MIN_NODE_VERSION to something higher than what you're running with. See https://github.com/yargs/yargs-parser/blob/main/lib/index.ts#L19

@aahmadts
Copy link

aahmadts commented May 3, 2024

In our case we are using an old version of gulp that uses yargs parser as a dependency. We solved the issue by selecting the needed gulp tag in the pipelines.

npm i -g --quiet [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants