-2

I wanted to install a node module globally so that I could access it from anywhere. I ran the below command, apparently successfully ...

localhost:workspace satishp$ npm install -g git+https://github.com/ryohey/node-stratum-client.git
+ node-stratum-client@0.0.1
updated 1 package in 1.022s

and then I have a "run.js" file in which this is the first line

require("node-stratum-client")

However when I go to run my file ,it complains about not finding the module I just installed globally . Is there something else I need to do to get the module to install globally?

localhost:workspace satishp$ node run.js
module.js:557
    throw err;
    ^

Error: Cannot find module 'node-stratum-client'
    at Function.Module._resolveFilename (module.js:555:15)
    at Function.Module._load (module.js:482:25)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/satishp/Documents/workspace/run.js:1:63)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
satish
  • 703
  • 5
  • 23
  • 52
  • Possible duplicate of [NodeJS require a global module/package](https://stackoverflow.com/questions/15636367/nodejs-require-a-global-module-package) – nicholaswmin Mar 04 '18 at 21:10
  • As I'm using a Mac and not Ubuntu, woudl be so kind as to tell me where "npm install -g" installs global modules? – satish Mar 05 '18 at 02:52

1 Answers1

0

You can run npm config get prefix to find out where your modules are. I would also recommend checking out this thread for more relevant discussions