Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
SOLVED: npm error when I try to install anything
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
IchBinEin
n00b
n00b


Joined: 23 Jul 2024
Posts: 2

PostPosted: Tue Jul 23, 2024 1:44 pm    Post subject: SOLVED: npm error when I try to install anything Reply with quote

I'm trying to get started with React, and npm is the package manager of choice, but whenever I try to install anything with it, it dies with:
Code:
npm error LRUCache is not a constructor


I examined the logs, and they have messages like these:

Code:

12 verbose stack TypeError: LRUCache is not a constructor
12 verbose stack     at Object.<anonymous> (/usr/lib64/node_modules/npm/node_modules/cacache/lib/memoization.js:5:18)
12 verbose stack     at Module._compile (node:internal/modules/cjs/loader:1467:14)
12 verbose stack     at Module._extensions..js (node:internal/modules/cjs/loader:1551:10)
12 verbose stack     at Module.load (node:internal/modules/cjs/loader:1282:32)
12 verbose stack     at Module._load (node:internal/modules/cjs/loader:1098:12)
12 verbose stack     at TracingChannel.traceSync (node:diagnostics_channel:315:14)
12 verbose stack     at wrapModuleLoad (node:internal/modules/cjs/loader:215:24)
12 verbose stack     at Module.require (node:internal/modules/cjs/loader:1304:12)
12 verbose stack     at require (node:internal/modules/helpers:123:16)
12 verbose stack     at Object.<anonymous> (/usr/lib64/node_modules/npm/node_modules/cacache/lib/get.js:8:14)
13 error LRUCache is not a constructor


I have net-libs/nodejs-22.4.1, but I had this problem with an earlier version as well. Thanks in advance for your help.


Last edited by IchBinEin on Tue Jul 23, 2024 6:55 pm; edited 1 time in total
Back to top
View user's profile Send private message
IchBinEin
n00b
n00b


Joined: 23 Jul 2024
Posts: 2

PostPosted: Tue Jul 23, 2024 6:55 pm    Post subject: Reply with quote

I solved it myself--it was one of those irritating one-line fixes.

I opened up /usr/lib64/node_modules/npm/node_modules/cacache/lib/memoization.js and replaced this:

Code:
const { LRUCache } = require('lru-cache')


with this:

Code:
const LRUCache = require('lru-cache')
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum