0

I am using nvm and via it I have set node v8.11.3 as my default. I installed the varint package globally using npm install -g --verbose varint, specifically to see where it is being installed. Post install on running npm list -g I can see it, but requiring it in the node repl fails. I am not sure as to what the issue is here. I am also not in a directory which has a package.json from before.

UPDATE:

which npm : ~/.nvm/versions/node/v8.11.3/bin/npm which node : ~/.nvm/versions/node/v8.11.3/bin/node

Projjol
  • 1,195
  • 2
  • 12
  • 26
  • What OS are you on? Can you run `whereis npm` and `whereis node`? – Abijeet Patro Oct 28 '18 at 19:21
  • When you run a code which is requiring the package, is it being done from the same environment where node version is same? – AkshayM Oct 28 '18 at 19:28
  • Because while using nvm it is possible that you are working with different terminal having different version of node. You varint package could be in other version of node's package repo and you are running code in different environment. – AkshayM Oct 28 '18 at 19:29
  • @AbijeetPatro on Mac OS 10.12.6. Updated question with results, thanks for taking a look! – Projjol Oct 29 '18 at 07:44
  • @AkshayM yup, since I've set 8.11.3 as my default each session loads that by default. While installing I passed --verbose as well to see if it installed it under 8.11.3 and it did. Thanks for taking a look! – Projjol Oct 29 '18 at 07:45
  • Try this solution : https://stackoverflow.com/a/15623632/6080889 – dRoyson Oct 29 '18 at 07:55

0 Answers0