raineorshine / npm-check-updates

Find newer versions of package dependencies than what your package.json allows
Other
9.38k stars 325 forks source link

Error returned when running ncu -g using Windows Terminal #1031

Closed DanAtkinson closed 1 year ago

DanAtkinson commented 2 years ago

Version information:


Steps to Reproduce

Current Behavior

The error occurs whenever I run ncu -g from Powershell or the standard cmd within the Windows Terminal app (not the default command line).

Executing ncu -g --loglevel verbose, the below output was returned:

Initializing
Getting installed packages
C:\ProgramData\nvm\v12.20.1\node_modules\npm-check-updates\build\src\index.js:26
    throw err;
    ^

Error: Expected JSON from "npm ls --json--global". This could be due to npm instability.
`-- (empty)

    at parseJson (C:\ProgramData\nvm\v12.20.1\node_modules\npm-check-updates\build\src\package-managers\npm.js:104:15)
    at Object.list (C:\ProgramData\nvm\v12.20.1\node_modules\npm-check-updates\build\src\package-managers\npm.js:274:18)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async getInstalledPackages (C:\ProgramData\nvm\v12.20.1\node_modules\npm-check-updates\build\src\lib\getInstalledPackages.js:21:24)
    at async runGlobal (C:\ProgramData\nvm\v12.20.1\node_modules\npm-check-updates\build\src\lib\runGlobal.js:15:28)
    at async runUpgrades (C:\ProgramData\nvm\v12.20.1\node_modules\npm-check-updates\build\src\index.js:76:30)

Expected Behavior

If I run ncu -g --loglevel verbose executed from the standard command prompt (i.e. not using the Windows Terminal but just cmd), I get the following (correct) response:

Initializing
Getting installed packages
Fetching latest versions

 npm  6.14.10  →  8.3.0

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

npm -g install npm@8.3.0

Anything else

I thought that this issue might be related to a comment you made back in 2016 on #288 here but I'm not sure. I can't see anything else related to it.

I'd also like to take the opportunity here to wish you a happy new year and to say that npm-check-updates is an excellent package which is usually one of the first to be installed on a new machine/nvm instance!

Best wishes

raineorshine commented 2 years ago

Ideas:

DanAtkinson commented 2 years ago

When I run npm ls --json --global I get the following output:

{
  "resolved": "file:../ProgramData/nvm/v12.20.1",
  "dependencies": {
    "@angular/cli": {
      "version": "13.1.2"
    },
    "bower": {
      "version": "1.8.13"
    },
    "dictionary-en-gb": {
      "version": "2.3.0"
    },
    "dictionary-en": {
      "version": "3.1.0"
    },
    "editorconfig": {
      "version": "0.15.3"
    },
    "eslint": {
      "version": "8.6.0"
    },
    "grunt-cli": {
      "version": "1.4.3"
    },
    "grunt-contrib-sass": {
      "version": "2.0.0"
    },
    "gulp": {
      "version": "4.0.2"
    },
    "jshint": {
      "version": "2.13.3"
    },
    "ngma": {
      "version": "1.0.6"
    },
    "npm-check-updates": {
      "version": "12.1.0"
    },
    "npm": {
      "version": "8.3.0"
    },
    "typescript": {
      "version": "4.5.4"
    },
    "webpack": {
      "version": "5.65.0"
    },
    "windows-build-tools": {
      "version": "5.2.2"
    }
  }
}

In terms of npm or npm.cmd forgive me but how would I determine this?

As a fairly important addendum, this problem only seems to occur when I elevate my permissions to administrator (via gsudo). Admin privileges are required for me to make changes and I can't open Windows Terminal as an administrator.

raineorshine commented 2 years ago

When I run npm ls --json --global I get the following output:

Is that when you elevate your permissions to administrator?

DanAtkinson commented 2 years ago

When I run npm ls --json --global I get the following output:

Is that when you elevate your permissions to administrator?

This is both as a standard user and as an administrator.

The results are the same in both scenarios, presumably as the resolved property is file:../ProgramData/nvm/v12.20.1 for each.

raineorshine commented 2 years ago

The results are the same in both scenarios, presumably as the resolved property is file:../ProgramData/nvm/v12.20.1 for each.

Yes, that's correct. The question is, why isn't npm-check-updates getting that result? Since it is running the same command under the hood with spawn.

I looked at the code and it's possible that it is suppressing stderr in global mode so we are not seeing the underlying problem. I changed this to output the subprocess's stderr in the error message that you get. Can you try installing npm-check-updates@next and re-running ncu -g , and let me know when you get?

DanAtkinson commented 2 years ago

I updated the package and then re-ran ncu -g. I got the following output:

C:\ProgramData\nvm\v12.20.1\node_modules\npm-check-updates\build\src\index.js:26
    throw err;
    ^

Error: Expected JSON from "npm.cmd ls --json --global". This could be due to npm instability.

Refreshing environment variables from registry for cmd.exe. Please wait...Finished..
D:\Refreshing environment variables from registry for cmd.exe. Please wait...Finished..
`-- (empty)

    at parseJson (C:\ProgramData\nvm\v12.20.1\node_modules\npm-check-updates\build\src\package-managers\npm.js:104:15)
    at Object.list (C:\ProgramData\nvm\v12.20.1\node_modules\npm-check-updates\build\src\package-managers\npm.js:276:18)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async getInstalledPackages (C:\ProgramData\nvm\v12.20.1\node_modules\npm-check-updates\build\src\lib\getInstalledPackages.js:21:24)
    at async runGlobal (C:\ProgramData\nvm\v12.20.1\node_modules\npm-check-updates\build\src\lib\runGlobal.js:15:28)
    at async runUpgrades (C:\ProgramData\nvm\v12.20.1\node_modules\npm-check-updates\build\src\index.js:76:30)

The command "Refreshing environment variables from registry for cmd.exe..." is likely called from HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun whose value is refreshenv (references Chocolatey, a Windows package manager).

raineorshine commented 2 years ago

Hmmm. Well that doesn't help us much does it. I don't have a Windows machine, so I'm not sure what to try next.

DanAtkinson commented 2 years ago

Not to worry I appear to be an edge case and I can get around it with the classic terminal if needed.

It doesn't seem to be a common issue and I imagine that there are a lot of people using your package with Windows Terminal.

kaaax0815 commented 2 years ago

I have the same issue with version 12.5.2 (installed with yarn) on all terminals

C:\Users\User\AppData\Local\Yarn\Data\global\node_modules\npm-check-updates\build\src\index.js:26
    throw err;
    ^
error Command "g" not found.

(Use `node --trace-uncaught ...` to show where the exception was thrown)
toivan commented 2 years ago

Same issue on Ubuntu `sudo ncu -g -u /usr/local/lib/node_modules/npm-check-updates/build/src/index.js:26 throw err; ^

Error: Expected JSON from "npm ls --json --global". This could be due to npm instability.`

at parseJson (/usr/local/lib/node_modules/npm-check-updates/build/src/package-managers/npm.js:113:15)
at Object.list (/usr/local/lib/node_modules/npm-check-updates/build/src/package-managers/npm.js:297:18)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async getInstalledPackages (/usr/local/lib/node_modules/npm-check-updates/build/src/lib/getInstalledPackages.js:21:24)
at async runGlobal (/usr/local/lib/node_modules/npm-check-updates/build/src/lib/runGlobal.js:15:28)
at async runUpgrades (/usr/local/lib/node_modules/npm-check-updates/build/src/index.js:76:30)
srmagura commented 2 years ago

I tried to reproduce this but couldn't. Ran both ncu -g and gsudo ncu -g from Windows Terminal (PowerShell 7.2.5) and there was no error.

Version information:

netcore-jroger commented 2 years ago
# ncu -i
Upgrading E:\self\repositories\xxx-project\frontend\package.json
[====================] 46/46 100%

√ Choose which packages to update »

 @babel/core                          ^7.19.0  →    ^7.19.1
 @babel/plugin-proposal-decorators    ^7.19.0  →    ^7.19.1
 @tanem/react-nprogress               ^5.0.12  →    ^5.0.14
 @types/lodash                      ^4.14.184  →  ^4.14.185
 @types/node                         ^18.7.15  →   ^18.7.18
 @types/react                        ^18.0.18  →   ^18.0.20
 ahooks                                ^3.7.0  →     ^3.7.1
 antd                                  4.23.0  →     4.23.2
 classnames                            ^2.3.1  →     ^2.3.2
 react-router-dom                      ^6.3.0  →     ^6.4.0
 typescript                            ^4.8.2  →     ^4.8.3
 web-vitals                            ^3.0.1  →     ^3.0.2

√ Run pnpm install to install new versions? ... yes

C:\Users\xxx\AppData\Roaming\npm\node_modules\npm-check-updates\build\src\index.js:56
    throw err;
    ^

(Use `node --trace-uncaught ...` to show where the exception was thrown)
srmagura commented 2 years ago

Just checked the code and the error posted by @netcore-jroger (and likely OP as well) is coming from

// exit with non-zero error code when there is an unhandled promise rejection
process.on('unhandledRejection', err => {
    throw err;
});

So that's not very helpful...

@netcore-jroger can you run ncu --loglevel verbose and send us the output? And are you using Windows Terminal too?

netcore-jroger commented 2 years ago

@srmagura yes I using Windows Terminal.

netcore-jroger commented 2 years ago

@srmagura

 jroger on  E:/self/repositories/xxx/xxx.dashboard develop
# ncu
Checking E:\self\repositories\xxx\xxx.dashboard\package.json
[====================] 53/53 100%

 react-router-dom    ^6.4.0  →  ^6.4.1
 react-tsparticles   ^2.3.1  →  ^2.3.2
 tsparticles         ^2.3.1  →  ^2.3.2
 tsparticles-engine  ^2.3.1  →  ^2.3.2

Run ncu -u to upgrade package.json
 jroger on  E:/self/repositories/xxx/xxx.dashboard develop
# ncu -i --loglevel verbose
Initializing
Running in local mode
Finding package file data
Upgrading E:\self\repositories\xxx\xxx.dashboard\package.json

Options:
{
  args: [],
  cache: false,
  cacheExpiration: 10,
  cacheFile: '~/.ncu-cache.json',
  cacher: undefined,
  cli: true,
  concurrency: 8,
  deep: false,
  dep: 'prod,dev,bundle,optional',
  errorLevel: 1,
  format: [],
  interactive: true,
  json: false,
  loglevel: 'verbose',
  minimal: false,
  packageManager: 'npm',
  prefix: undefined,
  reject: [],
  retry: 3,
  target: 'latest',
  upgrade: true,
  withWorkspace: [],
  workspace: []
}

Current versions:
{
  '@ant-design/icons': '^4.7.0',
  '@ant-design/pro-components': '2.3.10',
  '@tinymce/tinymce-react': '^4.2.0',
  ahooks: '^3.7.1',
  antd: '^4.23.2',
  axios: '^0.27.2',
  'chart.js': '^3.9.1',
  classnames: '^2.3.2',
  'core-js': '^3.25.2',
  'crypto-js': '^4.1.1',
  dayjs: '^1.11.5',
  history: '^5.3.0',
  'js-base64': '^3.7.2',
  lodash: '^4.17.21',
  nprogress: '^0.2.0',
  prismjs: '^1.29.0',
  qs: '^6.11.0',
  'rc-picker': '^2.6.10',
  'rc-queue-anim': '^2.0.0',
  react: '^18.2.0',
  'react-chartjs-2': '^4.3.1',
  'react-dom': '^18.2.0',
  'react-error-boundary': '^3.1.4',
  'react-is': '^18.2.0',
  'react-router-dom': '^6.4.0',
  'react-transition-group': '^4.4.5',
  'react-tsparticles': '^2.3.1',
  recoil: '^0.7.5',
  'styled-components': '^5.3.5',
  tinymce: '^6.2.0',
  tsparticles: '^2.3.1',
  'tsparticles-engine': '^2.3.1',
  'use-media-antd-query': '^1.1.0',
  'web-vitals': '^3.0.2',
  '@types/crypto-js': '^4.1.1',
  '@types/lodash': '^4.14.185',
  '@types/node': '^18.7.18',
  '@types/nprogress': '^0.2.0',
  '@types/prismjs': '^1.26.0',
  '@types/qs': '^6.9.7',
  '@types/react': '^18.0.20',
  '@types/react-color': '^3.0.6',
  '@types/react-dom': '^18.0.6',
  '@types/react-router-dom': '^5.3.3',
  '@types/react-transition-group': '^4.4.5',
  '@types/styled-components': '^5.1.26',
  '@vitejs/plugin-react': '^2.1.0',
  'antd-dayjs-vite-plugin': '^1.2.0',
  less: '^4.1.3',
  terser: '^5.15.0',
  typescript: '^4.8.3',
  vite: '^3.1.3',
  'vite-plugin-imp': '^2.3.0'
}

Fetching latest versions

Fetched versions:
{
  '@ant-design/icons': '4.7.0',
  '@ant-design/pro-components': '2.3.10',
  '@tinymce/tinymce-react': '4.2.0',
  ahooks: '3.7.1',
  antd: '4.23.2',
  axios: '0.27.2',
  'chart.js': '3.9.1',
  classnames: '2.3.2',
  'core-js': '3.25.2',
  'crypto-js': '4.1.1',
  dayjs: '1.11.5',
  history: '5.3.0',
  'js-base64': '3.7.2',
  lodash: '4.17.21',
  nprogress: '0.2.0',
  prismjs: '1.29.0',
  qs: '6.11.0',
  'rc-picker': '2.6.10',
  'rc-queue-anim': '2.0.0',
  react: '18.2.0',
  'react-chartjs-2': '4.3.1',
  'react-dom': '18.2.0',
  'react-error-boundary': '3.1.4',
  'react-is': '18.2.0',
  'react-router-dom': '6.4.1',
  'react-transition-group': '4.4.5',
  'react-tsparticles': '2.3.2',
  recoil: '0.7.5',
  'styled-components': '5.3.5',
  tinymce: '6.2.0',
  tsparticles: '2.3.2',
  'tsparticles-engine': '2.3.2',
  'use-media-antd-query': '1.1.0',
  'web-vitals': '3.0.2',
  '@types/crypto-js': '4.1.1',
  '@types/lodash': '4.14.185',
  '@types/node': '18.7.18',
  '@types/nprogress': '0.2.0',
  '@types/prismjs': '1.26.0',
  '@types/qs': '6.9.7',
  '@types/react': '18.0.20',
  '@types/react-color': '3.0.6',
  '@types/react-dom': '18.0.6',
  '@types/react-router-dom': '5.3.3',
  '@types/react-transition-group': '4.4.5',
  '@types/styled-components': '5.1.26',
  '@vitejs/plugin-react': '2.1.0',
  'antd-dayjs-vite-plugin': '1.2.0',
  less: '4.1.3',
  terser: '5.15.0',
  typescript: '4.8.3',
  vite: '3.1.3',
  'vite-plugin-imp': '2.3.0'
}

Upgraded versions:
{
  'react-router-dom': '^6.4.1',
  'react-tsparticles': '^2.3.2',
  tsparticles: '^2.3.2',
  'tsparticles-engine': '^2.3.2'
}

√ Choose which packages to update »

 (*) react-router-dom    ^6.4.0  →  ^6.4.1
 (*) react-tsparticles   ^2.3.1  →  ^2.3.2
 (*) tsparticles         ^2.3.1  →  ^2.3.2
 (*) tsparticles-engine  ^2.3.1  →  ^2.3.2

√ Run pnpm install to install new versions? ... yes

C:\Users\xxx\AppData\Roaming\npm\node_modules\npm-check-updates\build\src\index.js:56
    throw err;
    ^

(Use `node --trace-uncaught ...` to show where the exception was thrown)
# ncu --version
16.2.1
netcore-jroger commented 2 years ago

@srmagura I modify C:\Users\xxx\AppData\Roaming\npm\node_modules\npm-check-updates\build\src\index.js file and add log like this:

// exit with non-zero error code when there is an unhandled promise rejection
process.on('unhandledRejection', err => {
+    console.log('>>>>>>>>>>>>>>>>>', JSON.stringify(err))
    throw err;
});

got the following log:

# ncu -i
Upgrading E:\self\repositories\onion\onion.dashboard\package.json
[====================] 53/53 100%

√ Choose which packages to update »

 (*) @ant-design/pro-components  2.3.10  →  2.3.12

√ Run pnpm install to install new versions? ... yes
+ >>>>>>>>>>>>>>>>> ""

C:\Users\xxx\AppData\Roaming\npm\node_modules\npm-check-updates\build\src\index.js:57
    throw err;
    ^

(Use `node --trace-uncaught ...` to show where the exception was thrown)
ivanmir commented 1 year ago

Hi @srmagura,

I am also getting the same error as @netcore-jroger. Except that I am getting a file not found error:

C:\Develop>ncu -i
>>>>>>>>>>>>>>>>> "The system cannot find the path specified.\r\n"

C:\Develop\nvs\node\14.20.1\x64\node_modules\npm-check-updates\build\src\index.js:57
    throw err;
    ^
The system cannot find the path specified.

(Use `node --trace-uncaught ...` to show where the exception was thrown)

Best regards, Ivan

ivanmir commented 1 year ago

I did the following modification on the code:

process.on('unhandledRejection', (reason, promise) => {
    console.log("promise: ", promise);
    //throw reason;
});

So, instead of throwing an error, I now get the promise that caused the unhandled rejection:

C:\>ncu -i -g
promise:  Promise {
  <rejected> 'The system cannot find the path specified.\r\n'
}
promise:  Promise {
  <rejected> TypeError: Cannot read property 'match' of undefined
      at Object.defaultPrefix (C:\Develop\nvs\node\14.20.1\x64\node_modules\npm-check-updates\build\src\package-managers\npm.js:396:34)
      at processTicksAndRejections (internal/process/task_queues.js:95:5)
      at async run (C:\Develop\nvs\node\14.20.1\x64\node_modules\npm-check-updates\build\src\index.js:179:26)
}

I coudn't really understand why the 'prefix.match' is failing on my machine.

I use Node Version Switch to handle multiple versions of nodejs on my Windows machine. It creates a linked folder to point the to the version that sits on another directory:

C:\>npm config get prefix
C:\Program Files\nodejs

I didn't have this issue before with ncu and node version 14.

Right now I have installed node version 14.20.1, but I also tested with other versions of node and I get the same error.

BTW: after commenting the 'throw' line, when I don't use the '-g' switch, the program checks the package.json, but it still displays the console log message. However, this time there are no promise errors:

C:\Develop\node-wksp\test>ncu
promise:  Promise {
  <rejected> 'The system cannot find the path specified.\r\n'
}
Checking C:\Develop\node-wksp\test\package.json
[====================] 29/29 100%

 @sap/audit-logging     5.3.0  →     5.5.6
 @sap/cds              ^5.6.4  →    ^6.2.1
 @sap/hana-client    ^2.10.20  →  ^2.14.18
 @sap/hdbext           ^7.4.1  →    ^7.6.6
 @sap/logging          ^6.0.3  →    ^6.1.3
 @sap/textbundle       ^4.0.0  →    ^4.1.0
 @sap/xsenv             3.1.1  →     3.3.2
 @sap/xssec            3.2.11  →    3.2.14
 body-parser            ~1.19  →     ~1.20
 express              ^4.17.1  →   ^4.18.2
 hdb                  ^0.19.0  →   ^0.19.5
 helmet                  ~4.6  →      ~6.0
 jest                 ^27.4.3  →   ^29.1.2
 jest-junit           ^13.0.0  →   ^14.0.1
 node-xlsx              ~0.17  →     ~0.21
 node-zip              ^1.0.1  →    ^1.1.1
 passport              ~0.5.0  →    ~0.6.0
 uuid                  ^8.3.2  →    ^9.0.0
 vsts-npm-auth        ^0.41.0  →   ^0.42.1
 winston                 ~3.3  →      ~3.8
 ws                      ~8.3  →      ~8.9
 xmldoc                ~1.1.2  →    ~1.2.0

Run ncu -u to upgrade package.json

Best regards, Ivan

raineorshine commented 1 year ago

Thanks @ivanmir, that's helpful.

So, instead of throwing an error, I now get the promise that caused the unhandled rejection:

C:\>ncu -i -g
promise:  Promise {
  <rejected> 'The system cannot find the path specified.\r\n'
}
promise:  Promise {
  <rejected> TypeError: Cannot read property 'match' of undefined
      at Object.defaultPrefix (C:\Develop\nvs\node\14.20.1\x64\node_modules\npm-check-updates\build\src\package-managers\npm.js:396:34)
      at processTicksAndRejections (internal/process/task_queues.js:95:5)
      at async run (C:\Develop\nvs\node\14.20.1\x64\node_modules\npm-check-updates\build\src\index.js:179:26)
}

What you're seeing here I believe are two separate unhandled promise rejections. The second is indeed related to prefix.match, but the first has no stack trace so unfortunately we don't know the source of the error. Something is throwing a string instead of an Error. You would have to manually add some console.logs and trace it back to the source.

I coudn't really understand why the 'prefix.match' is failing on my machine.

That seems to be a bug. It should simply fall through and not use a prefix. I just added a guard in 609fc72 and published to v16.3.12, so at least that promise rejection should be handled now. Thanks for bringing it to my attention.

ivanmir commented 1 year ago

Hi @raineorshine,

I really appreciate your support on this.

I tried to debug this issue on my machine. And here what I've found out. I've created a test file with a simple code like so:

async function exec() {
    try {
        const cmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
        const output = await spawn_please_1.default(cmd, ['list', '-g', '-depth', '0']);
        console.log('Output: ', output);
        return output;
    } catch (stderr) {
        console.log('Error: ', stderr);
    }
}
const a = exec();

This code doesn't work on my Windows machine. So, while debugging it I've reached into index.js from 'spawn-please'. The code above does run and produces the expected output during debug until it reaches the onClose from spawn-please:

    child.on('close', code => {
      if (code !== 0 && options.rejectOnError) {
        reject(stderr)
      }
      else {
        resolve(stdout)
      }
    })

While inspecting it, on my machine this variable 'code' is returning as '1' instead of '0'. However, when I enter the same command issued by my test program, I don't get any error messages.

I've also tested another spawn library (see below) and there is no error message being returned:

const spawn = require('cross-spawn');
const result = spawn.sync('npm.cmd', ['list', '-g', '-depth', '0'], { stdio: 'inherit' });

Any ideas?

Best regards, Ivan

ivanmir commented 1 year ago

Hi @raineorshine,

Quick update:

I've added the following arguments to 'spawn-please' on file 'package-managers\npm.js', line 211

return (0, spawn_please_1.default)(cmd, ['--version'], { shell: true })

And line 387 (same file):

prefix = await (0, spawn_please_1.default)(cmd, ['config', 'get', 'prefix'], { shell: true });

And now everything works.

Best regards, Ivan

raineorshine commented 1 year ago

Thanks @ivanmir, that's great information. I wasn't aware of all the issues that child_process.spawn has on Windows.

I have updated spawn-please to use cross-spawn, pulled it into npm-check-updates with #1209, and published to v16.3.15. Let me know if this improves the situation.

imirisola commented 1 year ago

Hi @raineorshine,

Apparently that has fixed the issues on my machine. Thanks I really appreciate it.

Best regards, Ivan

DanAtkinson commented 1 year ago

Hello.

I got an email today about this and my apologies but most of the updates have been automatically marked as read by my over-zealous rules.

I did an update of this package but got the following error:

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

Error: Cannot find module 'fs/promises'
Require stack:
- C:\ProgramData\nvm\v12.20.1\node_modules\npm-check-updates\build\src\lib\getRepoUrl.js
- C:\ProgramData\nvm\v12.20.1\node_modules\npm-check-updates\build\src\lib\logging.js
- C:\ProgramData\nvm\v12.20.1\node_modules\npm-check-updates\build\src\lib\cache.js
- C:\ProgramData\nvm\v12.20.1\node_modules\npm-check-updates\build\src\cli-options.js
- C:\ProgramData\nvm\v12.20.1\node_modules\npm-check-updates\build\src\bin\cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (C:\ProgramData\nvm\v12.20.1\node_modules\npm-check-updates\build\src\lib\getRepoUrl.js:7:36)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\ProgramData\\nvm\\v12.20.1\\node_modules\\npm-check-updates\\build\\src\\lib\\getRepoUrl.js',
    'C:\\ProgramData\\nvm\\v12.20.1\\node_modules\\npm-check-updates\\build\\src\\lib\\logging.js',
    'C:\\ProgramData\\nvm\\v12.20.1\\node_modules\\npm-check-updates\\build\\src\\lib\\cache.js',
    'C:\\ProgramData\\nvm\\v12.20.1\\node_modules\\npm-check-updates\\build\\src\\cli-options.js',
    'C:\\ProgramData\\nvm\\v12.20.1\\node_modules\\npm-check-updates\\build\\src\\bin\\cli.js'
  ]
}

This happens from my command line (not even using Windows Terminal)

I'm running this particular site on npm-check-updates@16.3.18 and npm@8.4.0 under node.js 12.20.1.

Happy to split this out into a separate issue if desired.

raineorshine commented 1 year ago

npm-check-updates requires NodeJS >= v14.14.

Node v12 reached end-of-life on 2022-04-30 and is no longer maintained.