biojs/edu

use nvm in tutorials instead of requiring `sudo`

blahah opened this issue · 3 comments

It's generally considered bad practice to run node installations that require sudo - the best way is to keep npm packages in user-space. The easiest way to do that is to install node with nvm.

nvm is the node version manager. Like RVM for Ruby, it lets you manage your node installation. The best thing about it in my opinion is that users can get node installed in a single command that works on OSX and linux:

$ curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | bash

When we do workshops on our Node software for ContentMine we find nvm makes it much easier for users. It also breaks much less than when you use platform-specific installers, and it avoids the suspicion raised when you ask people to execute arbitrary code with sudo.

So for you guys it would look something like:

$ curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | bash # install nvm
$ nvm install 0.10.30 && nvm alias default 0.10.30 && nvm use default # install node & npm
$ npm install --global slush

No sudo required.

nvm is great for its intended goal - multi node version environments - not sure it's the correct solution to installing node in general.

Mostly I recommend people install via the nodejs.org installer - are there issues you've hit with this approach?

I would argue that any node installation should be managing versions, and that this is the nicest setup you can instruct new users to create.

The nodejs.org installer is fine, especially for Windows and OSX, but it's a bit slow to get going on Linux in a workshop, and requires doing a different thing on every OS.

This issue was a reaction to the BioJS workshop/demo at EU CODEFEST where the install instructions all suggested using apt-get or similar and led to a situation where lots of people had errors related to npm needing sudo for global installs.

Thanks @blahah for mentioning.

I added this hint to our edu pages 4795684

http://edu.biojs.net/series/101/20_getting_started.html


.

Linux ... requires doing a different thing on every OS.

Yeah because every OS has it's own package manager. Unfortunately due to the fast development speed of npm not all distributions manage to catch up with it.

However this guide is awesome and covers many distro.

install instructions all suggested using apt-get

I am a convinced ArchLinux user and their support for nodejs is excellent.
AFAIK apt-get install npm should work fine on Ubuntu 14.04 ?

When we do workshops on our Node software for ContentMine we find nvm makes it much easier for users
[...]
errors related to npm needing sudo for global installs

I still think that sudo is the easiest option for newbies, but next time we will mention this option :)