'npm install error: npm ERR! Cannot read property 'insert' of undefined

Trying to install express or any other package with npm brings forth this error "npm ERR! Cannot read property 'insert' of undefined"

Ubuntu 22.04 LTS

[email protected]

[email protected]

Sections of debug log

0 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'install', 'express' ] 1 info using [email protected]

2 info using [email protected]

23 verbose logfile /home/kiama/.npm/_logs/2022-04-25T18_29_12_505Z-debug-0.log

24 timing npm:load:logFile Completed in 12ms

25 timing npm:load:timers Completed in 0ms

26 timing npm:load:configScope Completed in 0ms

27 timing npm:load Completed in 73ms

28 timing arborist:ctor Completed in 2ms

29 silly logfile start cleaning logs, removing 1 files

34 silly fetch manifest express@*

35 silly placeDep ROOT express@ OK for: [email protected] want: *

36 timing idealTree:#root Completed in 458ms

37 timing idealTree:node_modules/express Completed in 1ms

38 timing idealTree:buildDeps Completed in 462ms

39 timing idealTree:fixDepFlags Completed in 0ms

40 timing idealTree Completed in 513ms

41 timing command:install Completed in 579ms

42 verbose stack TypeError: Cannot read property 'insert' of undefined

42 verbose stack at CacheEntry.store (/usr/share/nodejs/npm/node_modules/make-fetch-happen/lib/cache/entry.js:325:27)

42 verbose stack at cacheFetch (/usr/share/nodejs/npm/node_modules/make-fetch-happen/lib/cache/index.js:18:18)

44 verbose Linux 5.15.0-25-generic

45 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "express"

46 verbose node v12.22.9

47 verbose npm v8.5.1

48 error Cannot read property 'insert' of undefined



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source