Home > other >  Trying to install node-fetch but it results in an error
Trying to install node-fetch but it results in an error

Time:07-17

I started to mess around with discord bots and I would need node-fetch for the tutorial which I started learning from.

I'm simply trying to run: (to install node-fetch)

npm install node-fetch

Which results in an error seen below.

This is the actual error from the log files:

TypeError: Cannot read properties of null (reading 'matches')
     at Link.matches (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\node.js:1107:41)
     at Link.canDedupe (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\node.js:1061:15)
     at PlaceDep.pruneDedupable (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\place-dep.js:468:14)
     at PlaceDep.placeInTree (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\place-dep.js:329:14)
     at PlaceDep.place (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\place-dep.js:216:10)
     at new PlaceDep (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\place-dep.js:73:10)
     at C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:990:31
     at Array.map (<anonymous>)
     at Arborist.[buildDepStep] (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:990:8)
at async Arborist.buildIdealTree (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:218:7)

What can I do here to solve this issue?

Thanks in advance.

enter image description here

CodePudding user response:

Try to install a lower version. Try npm install node-fetch@2 it worked for me. Before that do npm cache clean –force which clears the cache.

CodePudding user response:

Solved, was an npm cache issue if I understand correctly, check this out:

https://github.com/node-fetch/node-fetch/issues/1603

  • Related