每次打电话都出错
npm install
,
Nodejs 版本(尝试过 18、20、22)以及我在全局或项目中调用 npm 的位置并不重要
>npm i -g pnpm@latest
npm error LRUCache is not a constructor
尝试重新安装几个版本的nodejs。 你知道会发生什么吗?我什至不知道什么是 LRUCache,我没有使用它
我的npm是10.7.0
我打开 /usr/lib64/node_modules/npm/node_modules/cacache/lib/memoization.js 并找到了这一行:
const { LRUCache } = require('lru-cache')
我把它改成这样:
const LRUCache = require('lru-cache')
这是针对 Linux 的。在 Windows 上,我想您可以在以下位置找到 memoization.js:
C:\Users\<REPLACE WITH YOUR USER FOLDER'S NAME>\AppData\Roaming\npm\node_modules\cacache\lib\memoization.js