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

Cannot read property 'reduce' of undefined #38

Closed
mfrieling opened this issue May 10, 2021 · 5 comments
Closed

Cannot read property 'reduce' of undefined #38

mfrieling opened this issue May 10, 2021 · 5 comments
Milestone

Comments

@mfrieling
Copy link

I just installed npm-audit-resolver as described and executed resolve-audit and immediately got this error message:

>>>> npm audit --json
>>>> exit: 0
TypeError: Cannot read property 'reduce' of undefined
    at Object.askForResolutions (/home/linuxbrew/.linuxbrew/lib/node_modules/npm-audit-resolver/src/resolve/auditResolver.js:13:50)
    at /home/linuxbrew/.linuxbrew/lib/node_modules/npm-audit-resolver/resolve.js:17:30
    at processTicksAndRejections (node:internal/process/task_queues:94:5)

My intention of using this tool is to fix all dependencies listed by npm audit except one, which triggers a deprecation warning about several dozen times. As this deprecation is located in an external (commercial) package which I can't fix I want to keep Sass version < 1.32.0 until the vendor provides a fix.

@lenymo
Copy link

lenymo commented May 11, 2021

I have just noticed a similar thing when I tried to run resolve-audit today on my Mac running Big Sur 11.3.1.

Here's my error:

>>>> npm audit --json 
>>>> exit: 0
TypeError: Cannot read property 'reduce' of undefined
    at Object.askForResolutions (/usr/local/lib/node_modules/npm-audit-resolver/src/resolve/auditResolver.js:13:50)
    at /usr/local/lib/node_modules/npm-audit-resolver/resolve.js:17:30
    at processTicksAndRejections (node:internal/process/task_queues:94:5)

Trying to get around a fairly widespread postcss vuln which has just been identified: https://www.npmjs.com/advisories/1693

@lenymo
Copy link

lenymo commented May 12, 2021

Just wanted to clarify that I encountered the error while running both [email protected], [email protected] and [email protected]

@mkatanski
Copy link

mkatanski commented May 12, 2021

I'm afraid I have the same issue.

System:
MacOS Catalina 10.15.7
Node.js v14.15.0
npm-audit-resolver 2.3.0

error:

>>>> npm audit --json --registry https://registry.npmjs.org
>>>> exit: 0
TypeError: Cannot read property 'reduce' of undefined
    at Object.askForResolutions (/node_modules/npm-audit-resolver/src/resolve/auditResolver.js:13:50)
    at node_modules/npm-audit-resolver/resolve.js:17:30
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

EDIT: I think its related to the newest version of NPM (currently I have 7.12.1)

EDIT 2: I can confirm that installing older npm version solves the problem. In my case I did npm i -g npm@latest-6 which should point to the v6.14.13 according to https://www.npmjs.com/package/npm?activeTab=versions

I hope it will be helpful to someone ;)

@naugtur
Copy link
Owner

naugtur commented May 12, 2021

Hi, thanks for reporting. It's a duplicate.
#34

npm version 7 has introduced a significant breaking change to the audit output and I'm only now figuring it out.

For now, a workaround is to use npm6 or yarn1 audit capabilities or installing npm6 as a dev dependency if that's more suitable.

@naugtur naugtur added this to the target-v3 milestone May 27, 2021
@naugtur
Copy link
Owner

naugtur commented Jun 13, 2022

closing in favor of #34

@naugtur naugtur closed this as not planned Won't fix, can't repro, duplicate, stale Jun 13, 2022
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