isaacs / node-lru-cache

A fast cache that automatically deletes the least recently used items
http://isaacs.github.io/node-lru-cache/
ISC License
5.38k stars 353 forks source link

npm ERR! cannot set sizeCalculation without setting maxSize #240

Closed rossphillips70 closed 2 years ago

rossphillips70 commented 2 years ago

When running any NPM command I get the following error.

npm ERR! cannot set sizeCalculation without setting maxSize

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2022-06-05T16_01_53_913Z-debug.log

here is the debug log:

0 info it worked if it ends with ok 1 verbose cli [ 'node', '/usr/local/bin/npm', 'upgrade' ] 2 info using npm@6.13.4 3 info using node@v12.16.1 4 verbose node symlink /usr/local/bin/node 5 verbose stack TypeError: cannot set sizeCalculation without setting maxSize 5 verbose stack at new LRUCache (/usr/local/lib/node_modules/npm/node_modules/lru-cache/index.js:168:15) 5 verbose stack at Object. (/usr/local/lib/node_modules/npm/lib/fetch-package-metadata.js:30:15) 5 verbose stack at Module._compile (internal/modules/cjs/loader.js:1158:30) 5 verbose stack at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10) 5 verbose stack at Module.load (internal/modules/cjs/loader.js:1002:32) 5 verbose stack at Function.Module._load (internal/modules/cjs/loader.js:901:14) 5 verbose stack at Module.require (internal/modules/cjs/loader.js:1044:19) 5 verbose stack at require (internal/modules/cjs/helpers.js:77:18) 5 verbose stack at Object. (/usr/local/lib/node_modules/npm/lib/install/deps.js:15:28) 5 verbose stack at Module._compile (internal/modules/cjs/loader.js:1158:30) 5 verbose stack at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10) 5 verbose stack at Module.load (internal/modules/cjs/loader.js:1002:32) 5 verbose stack at Function.Module._load (internal/modules/cjs/loader.js:901:14) 5 verbose stack at Module.require (internal/modules/cjs/loader.js:1044:19) 5 verbose stack at require (internal/modules/cjs/helpers.js:77:18) 5 verbose stack at Object. (/usr/local/lib/node_modules/npm/lib/install.js:127:23) 6 verbose cwd /usr/local/lib/node_modules/npm/node_modules/lru-cache 7 verbose OpenBSD 7.1 8 verbose argv "node" "/usr/local/bin/npm" "upgrade" 9 verbose node v12.16.1 10 verbose npm v6.13.4 11 error cannot set sizeCalculation without setting maxSize 12 verbose exit [ 1, true ] ~

OpenBSD 7.1 (also occurred in 7.0, 6.9, and 6.8) npn -v 6.13.4 node -v 12.16.1

Can someone help with this? I would like to upgrade Node to at least 14.x

isaacs commented 2 years ago

Somehow you have npm v6 using lru-cache v7. That is not valid. Something is deeply wrong with your npm installation.

I recommend reinstalling node and npm.