nodeschool/discussions

Do modules need to be installed globally?

code4cake opened this issue ยท 12 comments

  • node version: <run "node -v" in you terminal and replace this> 4.4.7
  • npm version: <run "npm -v" in you terminal and replace this> 2.15.8

So I would like to run the modules from within a folder I created. I did npm install javascripting & npm install learnyounode the both installed, but I'm unable to run the modules within this folder. Globally I have no problems.

Is there a way around this?

Thanks

Is there an error? What happens when, after installing locally, you run

$ node_modules/javascripting/bin/javascripting

@noffle, thank you. I was still trying to run it by just calling javascripting
Your solution worked. Thanks.

Question to just run it with javascripting instead of node_modules/javascripting/bin/javascripting I would have to make that executable available in my path? Is this correct?

Thanks

Yes, that's correct. Something like export PATH=$PATH:/somepath/node_modules/javascripting/bin.

However, if your qualm with global installs is that it requires superuser privileges, you can tell npm to use e.g. your home directory for global installs:

$ npm set prefix $HOME/.npm-global

Now all npm -g installs you do will be placed here. This has the nice side effect of letting you set just one directory in your PATH to capture all globally installed executables:

export PATH=$PATH:$HOME/.npm-global/bin

@noffle right now I have a .npm/ directory on my home. But I think that's the same thing?. Anyways thanks for the help and for the info. Should I close this issue?

@dantesolis @noffle I feel like this should be noted somewhere on the homepage. I am busy with other things, but perhaps one of you could help everyone out and add a paragraph at a good place?

@martinheidegger & @noffle I could do it. I Just read the contribution section and about to clone the repo on my machine. Waiting for the greenlight

Go ahead. Make a PR and somebody can review it ๐Ÿ‘

@dantesolis Yes, please go ahead. Tag one of us once you open the PR. Thank you in advance ๐Ÿ˜ƒ

No problems. Thanks guys.

@dantesolis was so kind to add a section to the readme of nodeschool.github.io.

@dantesolis can this issue be closed?

@martinheidegger, yes, I'll go ahead and close it. And thanks guys for letting me contribute. Now to start working on those modules.