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

Broken ncu -g with Error since v16.14.13 #1365

Closed
3 tasks done
ath0mas opened this issue Jan 25, 2024 · 9 comments
Closed
3 tasks done

Broken ncu -g with Error since v16.14.13 #1365

ath0mas opened this issue Jan 25, 2024 · 9 comments
Labels

Comments

@ath0mas
Copy link
Contributor

ath0mas commented Jan 25, 2024

  • I have searched for similar issues
  • I am using the latest version of npm-check-updates
  • I am using node >= 14.14

Node 21.6.1
Npm 10.2.4


Steps to Reproduce

.ncurc:

Dependencies:

Steps:

ncu -g

Current Behavior

Error: Expected JSON from "npm.cmd ls --json --location=global". Instead received: Unknown command: "-"

To see a list of supported npm commands, run:
  npm help

    at parseJson (C:\Users\myuser\scoop\persist\nodejs\bin\node_modules\npm-check-updates\build\src\package-managers\npm.js:246:15)
    at Object.list (C:\Users\myuser\scoop\persist\nodejs\bin\node_modules\npm-check-updates\build\src\package-managers\npm.js:569:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async getInstalledPackages (C:\Users\myuser\scoop\persist\nodejs\bin\node_modules\npm-check-updates\build\src\lib\getInstalledPackages.js:22:22)
    at async runGlobal (C:\Users\myuser\scoop\persist\nodejs\bin\node_modules\npm-check-updates\build\src\lib\runGlobal.js:17:28)
    at async runUpgrades (C:\Users\myuser\scoop\persist\nodejs\bin\node_modules\npm-check-updates\build\src\index.js:197:26)

Expected Behavior

A "hotfix" consists in installing back v16.14.12:
npm -g install [email protected]

then ncu -g again

[====================] 8/8 100%

 npm-check-updates  16.14.12  →  16.14.13

ncu itself cannot upgrade global packages. Run the following to upgrade all global packages:

npm -g install [email protected]
@raineorshine
Copy link
Owner

Thanks, I'll take a look.

@vvyman
Copy link

vvyman commented Jan 26, 2024

node version v16.17.1 has a same error.

Error: Expected JSON from "npm ls --json --location=global". Instead received: Unknown command: "-"

To see a list of supported npm commands, run:
  npm help

    at parseJson (/opt/homebrew/lib/node_modules/npm-check-updates/build/src/package-managers/npm.js:246:15)
    at Object.list (/opt/homebrew/lib/node_modules/npm-check-updates/build/src/package-managers/npm.js:569:26)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async getInstalledPackages (/opt/homebrew/lib/node_modules/npm-check-updates/build/src/lib/getInstalledPackages.js:22:22)
    at async runGlobal (/opt/homebrew/lib/node_modules/npm-check-updates/build/src/lib/runGlobal.js:17:28)
    at async runUpgrades (/opt/homebrew/lib/node_modules/npm-check-updates/build/src/index.js:197:26)

Hope to give one more reference.😁

@EthanTuning
Copy link

Having this same issue as well. Not sure what would help, but I had the same output as the above is showing and I am on Mac OS Sonoma 14.2.1.

@solrevdev
Copy link

same here:

 ncu -g
Error: Expected JSON from "npm ls --json --location=global". Instead received: Unknown command: "-"

To see a list of supported npm commands, run:
  npm help

    at parseJson (/opt/homebrew/lib/node_modules/npm-check-updates/build/src/package-managers/npm.js:246:15)
    at Object.list (/opt/homebrew/lib/node_modules/npm-check-updates/build/src/package-managers/npm.js:569:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async getInstalledPackages (/opt/homebrew/lib/node_modules/npm-check-updates/build/src/lib/getInstalledPackages.js:22:22)
    at async runGlobal (/opt/homebrew/lib/node_modules/npm-check-updates/build/src/lib/runGlobal.js:17:28)
    at async runUpgrades (/opt/homebrew/lib/node_modules/npm-check-updates/build/src/index.js:197:26)

---    
ncu --version
16.14.13
---
node -v
v21.6.1

npm -v
10.4.0

computer_info
----------------------------
OS: macOS 14.3 23D56 arm64
Host: Macmini9,1
Kernel: 23.3.0
Uptime: 1 day, 15 hours, 36 mins
Packages: 380 (brew)
Shell: zsh 5.9
Resolution: 2560x1440, 2560x1440
DE: Aqua
WM: Quartz Compositor
WM Theme: Blue (Light)
Terminal: iTerm2
Terminal Font: CascadiaMonoPL-Regular 16
CPU: Apple M1
GPU: Apple M1
Memory: 2205MiB / 16384MiB

@EriksRemess
Copy link

@yhx-12243
Copy link

I think this was fixed in 50ec0b2#diff-97685716b4ca526530febb50f52d242ace881b7e1e77335325f50a554419423dL523

This commit is so old that is not the cause of the error. See my comment on the corresponding commit in this issue board.

@rafrafek
Copy link

May be a good idea to add ncu -g to the automated tests.

@raineorshine
Copy link
Owner

Fixed and published in v16.14.14. Thanks everyeone.

ncu -g was ostensibly under test coverage, but errors in global mode were returning the wrong exit code, which was causing a test false positive. I fixed this in a86905b and added more specific testing of the output, so this should not happen again.

@ath0mas
Copy link
Contributor Author

ath0mas commented Jan 26, 2024

Fixed and published in v16.14.14. Thanks everyeone.

ncu -g was ostensibly under test coverage, but errors in global mode were returning the wrong exit code, which was causing a test false positive. I fixed this in a86905b and added more specific testing of the output, so this should not happen again.

Thanks @raineorshine
I won't be able to check this quickly, but I'm sure it's OK, and people around will tell 😉

@ath0mas ath0mas closed this as completed Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants