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

Crash: TypeError: Cannot read properties of undefined (reading 'some') (related to program.opts().ignore ) #297

Closed
nvuillam opened this issue Mar 10, 2024 · 9 comments

Comments

@nvuillam
Copy link
Contributor

MegaLinter auto-upgrade job detected a crash with latest version v3.12.0 :(

Link to the job: https://github.com/oxsecurity/megalinter/actions/runs/8224703698/job/22488857571

Error detail

--Error detail:
(node:87) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
/node-deps/node_modules/markdown-link-check/markdown-link-check:97
                    if (program.opts().ignore.some((ignorePath) => resolved.includes(ignorePath))) {
                                             ^

TypeError: Cannot read properties of undefined (reading 'some')
    at Command.<anonymous> (/node-deps/node_modules/markdown-link-check/markdown-link-check:97:46)
    at Command.listener [as _actionHandler] (/node-deps/node_modules/commander/lib/command.js:482:17)
    at /node-deps/node_modules/commander/lib/command.js:1283:65
    at Command._chainOrCall (/node-deps/node_modules/commander/lib/command.js:1177:12)
    at Command._parseCommand (/node-deps/node_modules/commander/lib/command.js:1283:27)
    at Command.parse (/node-deps/node_modules/commander/lib/command.js:909:10)
    at getInputs (/node-deps/node_modules/markdown-link-check/markdown-link-check:108:7)
    at main (/node-deps/node_modules/markdown-link-check/markdown-link-check:252:20)

Node.js v21.4.0
@MikeMcC399
Copy link

@dklimpel
Copy link
Contributor

dklimpel commented Mar 11, 2024

Seems a regresson in #278 and NodeJS v21

@MikeMcC399
Copy link

@dklimpel

I'm not seeing any connection of this issue to the version of Node.js. It is reproducible for me on Node.js 18, 20 and 21. The previous version of markdown-link-check did not show the error TypeError: Cannot read properties of undefined (reading 'some') on any of the Node.js versions I listed.

@h4ck3rk3y
Copy link

Seeing this on our side as well; fixing 3.11.2 for while we wait for this to get resolved

lostbean added a commit to kurtosis-tech/kurtosis-docs-checker-orb that referenced this issue Mar 11, 2024
the current version is broken
tcort/markdown-link-check#297

Changelog picked up from commits here:

fix: use 3.11.2 as latest is broken

---------

Co-authored-by: Edgar Gomes <talktoedgar@gmail.com>
@MikeMcC399
Copy link

MikeMcC399 commented Mar 11, 2024

It seems that the markdown-link-check@3.12.0 CLI will only work if the option --ignore is present.

The file md.md in the following is a markdown file with only a title, no links. It can be checked with npx markdown-link-check md.md --ignore "dummy"

$ npx markdown-link-check md.md --ignore "dummy"

FILE: md.md
  No hyperlinks found!

  0 links checked.

With no --ignore option used, it fails:

$ npx markdown-link-check md.md
...\node_modules\markdown-link-check\markdown-link-check:97
                    if (program.opts().ignore.some((ignorePath) => resolved.includes(ignorePath))) {
                                             ^

TypeError: Cannot read properties of undefined (reading 'some')
    at Command.<anonymous> (D:\github2\others\markdown-link-ignore\node_modules\markdown-link-check\markdown-link-check:97:46)
    at Command.listener [as _actionHandler] (D:\github2\others\markdown-link-ignore\node_modules\commander\lib\command.js:482:17)
    at D:\github2\others\markdown-link-ignore\node_modules\commander\lib\command.js:1283:65
    at Command._chainOrCall (D:\github2\others\markdown-link-ignore\node_modules\commander\lib\command.js:1177:12)
    at Command._parseCommand (D:\github2\others\markdown-link-ignore\node_modules\commander\lib\command.js:1283:27)
    at Command.parse (D:\github2\others\markdown-link-ignore\node_modules\commander\lib\command.js:909:10)
    at getInputs (D:\github2\others\markdown-link-ignore\node_modules\markdown-link-check\markdown-link-check:108:7)
    at main (D:\github2\others\markdown-link-ignore\node_modules\markdown-link-check\markdown-link-check:252:20)

Node.js v20.11.1

Hopefully @CanadaHonk will be able to take a look.

@CanadaHonk
Copy link
Contributor

Oops, sorry! I'll take a look :)

CanadaHonk added a commit to CanadaHonk/markdown-link-check that referenced this issue Mar 11, 2024
@CanadaHonk
Copy link
Contributor

Should be fixed in #302

tcort added a commit that referenced this issue Mar 11, 2024
@tcort
Copy link
Owner

tcort commented Mar 11, 2024

Please try the latest release 3.12.1. Re-open if not fixed.

@tcort tcort closed this as completed Mar 11, 2024
@MikeMcC399
Copy link

@tcort

I checked my previous steps to reproduce and it looks good with markdown-link-check@3.12.1 CLI 👍🏻

andrzej-stencel added a commit to andrzej-stencel/opentelemetry-collector-contrib that referenced this issue Mar 12, 2024
dmitryax pushed a commit to open-telemetry/opentelemetry-collector-contrib that referenced this issue Mar 12, 2024
DougManton pushed a commit to DougManton/opentelemetry-collector-contrib that referenced this issue Mar 13, 2024
XinRanZhAWS pushed a commit to XinRanZhAWS/opentelemetry-collector-contrib that referenced this issue Mar 13, 2024
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

6 participants