2

My group works on a library that's distributed to other teams in our organization to use in their own projects. We recently introduced interactive examples, created in JS Bin, to our online documentation.

I've installed JS Bin globally to the server hosting our documentation using npm.

c:\npm install -g jsbin

However this installs jsbin to

c:\Users\<my user>\AppData\Roaming\npm\node_modules

Which isn't really what I want, because other developers will need to be able to start and stop this process. At first I was surprised that Node would install something in my own directory that I'd specified as "global," but then I read:

"-g is not a way to install global libraries, it's only a way to place them on system path so you can call them from command line without writing the full path to them" -- found that here: Nodejs cannot find installed module on Windows?

OK, fine. So what's the best way to install an npm module when it contains an executable that will be used by any number of users on the system? They'll all have admin privileges, but making people log in as administrator just to start or stop a process doesn't seem right.

Installation specifics:

  • Node version: 0.10.28
  • NPM version: 1.4.9
  • Node installation directory: C:\Program Files\nodejs

Your input is appreciated, and thank you in advance.

Community
  • 1
  • 1
Willy
  • 1,055
  • 8
  • 23
  • `npm install -g jsbin` installs it globally for me, but I am on OSX. – APAD1 Jun 12 '14 at 16:54
  • 1
    *Windows* is the key here. – Willy Jun 12 '14 at 16:56
  • Try the command in the order I posted, it should be the same for Windows or OSX. – APAD1 Jun 12 '14 at 16:58
  • Sorry for the confusion, I updated the question to reflect the fact that the command's order of parameters isn't the problem. – Willy Jun 12 '14 at 17:01
  • 1
    @BillF. Have you tried running an elevated command prompt, and then use `npm install -g`? – Brad Jun 12 '14 at 19:16
  • @Brad, even when I run cmd as administrator, `npm root -g` still outputs `c:\Users\\AppData\Roaming\npm\node_modules`. – Willy Jun 12 '14 at 19:38
  • Where is node installed on the machine? There are a few potential answers, but that's one variable that helps determine which are good. – Matthew Bakaitis Jun 13 '14 at 11:12
  • @MattBakaitis updated to address your question. – Willy Jun 13 '14 at 16:07
  • One last question: Are you seeking to give each developer the ability to run an instance of `jsbin` locally on their machine, using the 'global' install that's located on the server? Or do you want the developers to start an instance running/hosted on the server? A global install will **not** install the app as a service but only runs locally, so I'm asking because it's possible you are expecting different behavior than npm provides by default. – Matthew Bakaitis Jun 13 '14 at 17:46
  • @MattBakaitis -- I'm looking to achieve the latter; one instance running on the server that all users will be able to start/stop/etc. Sounds like this isn't something npm provides by default; is this even possible without jumping through a ton of hoops? – Willy Jun 13 '14 at 18:26
  • @BillF. npm does not do that by default and the jsbin module from the npm repo doesn't look like it has an 'install as a service' option. is it OK for the dev to remote desktop into the server to start up jsbin there? if so, then it can be done without too much hassle. – Matthew Bakaitis Jun 13 '14 at 18:31

0 Answers0