raineorshine / npm-check-updates

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

Error: minTimeout is greater than maxTimeout #1155

Closed HelioPC closed 2 years ago

HelioPC commented 2 years ago

I'm using the node 18.4.0, ncu 15.0.1, npm 8.12.1, macOs Monterey 12.4 (m1 chip).


Steps to Reproduce

ncu

Current Behavior

Captura de ecrã 2022-07-02, às 23 29 52

After updating to version 15.0.1, this error appeared.

raineorshine commented 2 years ago

Hi, thanks for reporting.

That's very strange. I am also on OSX 12.4 (m1 chip) and I didn't get this error with the exact same node, npm, and ncu versions.

I looked at the code and the only thing I noticed related to timeouts is that timeout: undefined is passed to pacote. As far as I can tell this is the same as not passing it at all, but maybe there is some version in the dependency tree that doesn't ignore it and perhaps does a 0 < undefined comparison with minTimeout.

I removed timeout when it is undefined, and published to ncu v15.0.2 if you'd like to give that a try.

Otherwise, it is likely a dependency bug.

HelioPC commented 2 years ago

Hey Raine, sorry for any inconvenience, I just analyzed the source code of the ncu (the files that were throwing the error) and found that the error was in my settings, specifically in fetch-retry-maxtimeout and fetch-retry-mintimeout whose values were 120000 and 30000 respectively. Although I'm correct (I believe), I reduced their values to 30000 and 3000, respectively. This didn't occur to me before because before the ncu update 15.0.1 everything was working correctly.

chungmarcoo commented 2 years ago

same issue here

node -v v16.17.0

ncu --version 16.3.2

raineorshine commented 2 years ago

@chungmarcoo Please post your npm config (tokens elided) and the result of ncu --verbose and I can investigate.

chungmarcoo commented 2 years ago

ncu --verbose

Using yarn
Initializing
Running in local mode
Finding package file data
Checking /Users/marco/Documents/<project-name>/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: [],
  json: false,
  loglevel: 'verbose',
  minimal: false,
  packageManager: 'yarn',
  prefix: null,
  reject: [],
  retry: 3,
  target: 'latest',
  verbose: true,
  workspace: []
}

Current versions:
{
  '@emotion/babel-preset-css-prop': '^11.2.0',
  '@emotion/react': '^11.9.0',
  '@emotion/server': '^11.4.0',
  '@emotion/styled': '^11.8.1',
  '@hookform/resolvers': '^2.8.10',
  '@ionic/react': '^6.1.9',
  '@mui/icons-material': '^5.10.6',
  '@mui/lab': '^5.0.0-alpha.101',
  '@mui/material': '^5.10.7',
  '@mui/styled-engine': '^5.10.7',
  '@popperjs/core': '^2.11.5',
  '@types/omit-deep-lodash': '^1.1.1',
  '@types/uuid': '^8.3.4',
  axios: '^0.27.2',
  graphql: '^16.4.0',
  'graphql-request': '^4.2.0',
  'graphql-tag': '^2.12.6',
  immer: '^9.0.13',
  lodash: '^4.17.21',
  next: '12.1.6',
  'next-query-params': '^2.2.1',
  'next-transpile-modules': '^9.0.0',
  'omit-deep-lodash': '^1.1.6',
  react: '18.1.0',
  'react-dnd': '^16.0.1',
  'react-dnd-html5-backend': '^16.0.1',
  'react-dom': '18.1.0',
  'react-hook-form': '^7.33.1',
  'react-player': '^2.10.1',
  'react-popper': '^2.3.0',
  'react-query': '^3.38.1',
  'react-table': '^7.7.0',
  'react-use': '^17.4.0',
  swiper: '^8.3.0',
  'use-text-selection': '^1.1.5',
  uuid: '^8.3.2',
  yup: '^0.32.11',
  zustand: '^4.0.0-rc.1',
  '@graphql-codegen/add': '^3.1.1',
  '@graphql-codegen/cli': '^2.6.2',
  '@graphql-codegen/core': '^2.5.1',
  '@graphql-codegen/typescript': '^2.4.8',
  '@graphql-codegen/typescript-operations': '^2.3.5',
  '@graphql-codegen/typescript-react-query': '^3.5.9',
  '@types/node': '17.0.31',
  '@types/react': '18.0.8',
  '@types/react-dom': '18.0.3',
  '@types/react-table': '^7.7.11',
  '@typescript-eslint/eslint-plugin': '^5.21.0',
  '@typescript-eslint/parser': '^5.21.0',
  'babel-plugin-direct-import': '^1.0.0',
  eslint: '^8.14.0',
  'eslint-config-next': '12.1.6',
  'eslint-config-prettier': '^8.5.0',
  'eslint-import-resolver-typescript': '^2.7.1',
  'eslint-plugin-prettier': '^4.0.0',
  'eslint-plugin-unused-imports': '^2.0.0',
  husky: '^8.0.0',
  'lint-staged': '^12.4.1',
  prettier: '^2.6.2',
  typescript: '4.6.4'
}

Fetching latest versions
/Users/marco/.nvm/versions/node/v16.17.0/lib/node_modules/npm-check-updates/build/src/index.js:56
    throw err;
    ^

Error: minTimeout is greater than maxTimeout
    at Object.exports.timeouts (/Users/marco/.nvm/versions/node/v16.17.0/lib/node_modules/npm-check-updates/node_modules/retry/lib/retry.js:29:11)
    at Object.exports.operation (/Users/marco/.nvm/versions/node/v16.17.0/lib/node_modules/npm-check-updates/node_modules/retry/lib/retry.js:4:26)
    at promiseRetry (/Users/marco/.nvm/versions/node/v16.17.0/lib/node_modules/npm-check-updates/node_modules/promise-retry/index.js:23:23)
    at remoteFetch (/Users/marco/.nvm/versions/node/v16.17.0/lib/node_modules/npm-check-updates/node_modules/make-fetch-happen/lib/remote.js:48:10)
    at fetch (/Users/marco/.nvm/versions/node/v16.17.0/lib/node_modules/npm-check-updates/node_modules/make-fetch-happen/lib/fetch.js:99:13)
    at makeFetchHappen (/Users/marco/.nvm/versions/node/v16.17.0/lib/node_modules/npm-check-updates/node_modules/make-fetch-happen/lib/index.js:10:10)
    at doFetch (/Users/marco/.nvm/versions/node/v16.17.0/lib/node_modules/npm-check-updates/node_modules/npm-registry-fetch/lib/index.js:108:15)
    at async RegistryFetcher.packument (/Users/marco/.nvm/versions/node/v16.17.0/lib/node_modules/npm-check-updates/node_modules/pacote/lib/registry.js:92:19)
    at async viewMany (/Users/marco/.nvm/versions/node/v16.17.0/lib/node_modules/npm-check-updates/build/src/package-managers/npm.js:233:18)
    at async viewMany (/Users/marco/.nvm/versions/node/v16.17.0/lib/node_modules/npm-check-updates/build/src/package-managers/npm.js:237:31)
raineorshine commented 2 years ago

@chungmarcoo And your npm config please?

chungmarcoo commented 2 years ago

@chungmarcoo And your npm config please?

; "user" config from /Users/marco/.npmrc

fetch-retry-maxtimeout = 120000 
fetch-retry-mintimeout = 20000 

; node bin location = /Users/marco/.nvm/versions/node/v16.17.0/bin/node
; node version = v16.17.0
; npm local prefix = /Users/marco
; npm version = 8.19.2
; cwd = /Users/marco
; HOME = /Users/marco
; Run `npm config ls -l` to show all defaults.
raineorshine commented 2 years ago

@chungmarcoo Thank you. I was able to reproduce the issue, and found that libnpmconfig does not parse the types of config values. So fetch-retry-maxtimeout was being set to '120000' and fetch-retry-mintimeout was being set to '20000', and of course '120000' > '2000' is false.

Fixed and published in v16.3.5.

chungmarcoo commented 2 years ago

Happy to hear your update. I will try the update tomorrow, appreciate for your work and have a good day.