Quantcast
Viewing all articles
Browse latest Browse all 6112

How to fix "Cannot read property 'then' of undefined at /usr/share/nodejs/cacache/lib/util/fix-owner.js"

I am trying to install osmtogeojson globally as follows on Ubuntu 22.04.3 LTS;

npm install -g osmtogeojson

I receive the following error message;

npm ERR! Cannot read property 'then' of undefinednpm ERR! A complete log of this run can be found in:npm ERR!     /root/.npm/_logs/2024-05-24T23_49_38_390Z-debug-0.log

Here is the content of the referenced log file above:

0 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'install', '-g', 'osmtogeojson' ]1 info using npm@8.5.12 info using node@v12.22.93 timing npm:load:whichnode Completed in 0ms4 timing config:load:defaults Completed in 1ms5 timing config:load:file:/usr/share/nodejs/npm/npmrc Completed in 3ms6 timing config:load:builtin Completed in 3ms7 timing config:load:cli Completed in 6ms8 timing config:load:env Completed in 0ms9 timing config:load:project Completed in 1ms10 timing config:load:file:/root/.npmrc Completed in 0ms11 timing config:load:user Completed in 0ms12 timing config:load:file:/etc/npmrc Completed in 0ms13 timing config:load:global Completed in 0ms14 timing config:load:validate Completed in 0ms15 timing config:load:credentials Completed in 1ms16 timing config:load:setEnvs Completed in 1ms17 timing config:load Completed in 13ms18 timing npm:load:configload Completed in 14ms19 timing npm:load:setTitle Completed in 0ms20 timing config:load:flatten Completed in 2ms21 timing npm:load:display Completed in 5ms22 verbose logfile /root/.npm/_logs/2024-05-24T23_49_38_390Z-debug-0.log23 timing npm:load:logFile Completed in 5ms24 timing npm:load:timers Completed in 0ms25 timing npm:load:configScope Completed in 0ms26 timing npm:load Completed in 24ms27 timing arborist:ctor Completed in 1ms28 timing idealTree:init Completed in 9ms29 timing idealTree:userRequests Completed in 3ms30 silly idealTree buildDeps31 silly fetch manifest osmtogeojson@*32 verbose stack TypeError: Cannot read property 'then' of undefined32 verbose stack     at /usr/share/nodejs/cacache/lib/util/fix-owner.js:113:733 verbose cwd /34 verbose Linux 5.15.0-91-generic35 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "osmtogeojson"36 verbose node v12.22.9

Here is the function that includes line number 113;

106 function mkdirfix (cache, p, cb) {107   // we have to infer the owner _before_ making the directory, even though108   // we aren't going to use the results, since the cache itself might not109   // exist yet.  If we mkdirp it, then our current uid/gid will be assumed110   // to be correct if it creates the cache folder in the process.111   return Promise.resolve(inferOwner(cache)).then(() => {112     return mkdirp(p)113       .then((made) => {114         if (made) {115           return fixOwner(cache, made).then(() => made)116         }117       })118       .catch((err) => {119         if (err.code === 'EEXIST') {120           return fixOwner(cache, p).then(() => null)121         }122         throw err123       })124   })125 }

I don't understand the function but it seems to be barfing on mkdir(p), right? I am running the installation of osmtogeojson as root aswell. Also, there is something about cache in there that I do not understand.

I tried to search for this error but I cannot find anything about it. Any help truly appreciated.


Viewing all articles
Browse latest Browse all 6112

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>