|Tested on openSUSE||Recommended articles||Related articles|
What is NodeJS?
Nodejs in openSUSE is different than other distros, How?
In general, running nodejs on openSUSE is simpler than other platforms. Unlike others, simply installing nodejs installs not only local libraries but also User tools (particularly npm) which are typically installed separately by others.
This approach differs from all the following by not using openSUSE repositories and packages and would be the recommended approach for the following reasons
- You wish to run or develop using multiple versions of nodejs
- You wish to run the very latest version of nodejs from github(possibly unstable)
The following link is to the main page of nodejs. The recommended approaches to installing nodejs is to pull from the official python repos (using pip) or the official nodejs repos (using npm). You can also clone the nodeenv repository directly from github.
Instructions to use nodeenv are at the link and is pretty much the same as using virtualenv(for python) or rvm or rbenv (for Ruby), you download any versions you wish to a special location on your system and then can optionally apply your choice version to any app(targeting a file tree where the app lives) or globally (system-wide).
As of today, and whenever NodeJS and NPM from the Tumblewwed repos don't work, then installing from the nodejs repo for a "normal" openSUSE distro will likely work.
If you have tried installing nodejs and/or npm from anywhere and they don't work, remove them
zypper rm nodejs npm
Add the 13.2 nodejs repo and refresh
zypper ar http://download.opensuse.org/repositories/devel:/languages:/nodejs/openSUSE_13.2/ 13.2_nodejs && zypper ref
Install nodejs which will also pull in "bundled npm"
zypper in nodejs
You'll now have a working npm. Running npm the first time as always will take time to build the local cache.
Although nodejs can be installed using YAST, the following command line will work, too
zypper install nodejs
As of the time of this writing, I do not know any advantage to using the special nodejs repo, so do not currently recommend installing. If someone identifies a reason to do so, pls comment.
Update March 2017
On Leap 42.2, although zypper can search for "nodejs" and return the actual package names starting with "nodejs4" you have to specify "nodejs4" to actually install the packages. Unknown as of this writing whether other openSUSE versions are affected similarly.