From Fedora Project Wiki

m (→‎Why Fedora?: wikimarkup)
(Redirect Package Maintainer wiki links to docs.fp.o)
 
(7 intermediate revisions by 3 users not shown)
Line 19: Line 19:
== Installing Node.js and npm ==
== Installing Node.js and npm ==


=== Fedora 18 and later ===
=== Fedora 18 - 21 ===


Look for the <code>nodejs</code> and <code>npm</code> packages in your favorite graphical package manager, or run this:
Look for the <code>nodejs</code> and <code>npm</code> packages in your favorite graphical package manager, or run this:
Line 25: Line 25:
<pre>sudo yum install nodejs npm</pre>
<pre>sudo yum install nodejs npm</pre>


Can't wait for the latest and greatest version of node?  [[QA:Updates Testing|Grab it from ''updates-testing''].
Can't wait for the latest and greatest version of node?  [[QA:Updates Testing|Grab it from ''updates-testing'']].
 
=== Fedora 22 and newer ===
 
One can use a graphical package manager and search for <code>nodejs</code> or run:
 
<pre>sudo dnf install nodejs</pre>


=== RHEL 6 and friends ===
=== RHEL 6 and friends ===


Node.js and npm are currently available from the [EPEL|Fedora Extra Packages for Enterprise Linux (EPEL)] ''testing'' repository.  If you haven't already done so, [[EPEL#How_can_I_use_these_extra_packages.3F|enable EPEL]], then run this as <code>root</code>:
Node.js and npm are currently available from the [[EPEL|Fedora Extra Packages for Enterprise Linux (EPEL)]] repository.  If you haven't already done so, [[EPEL#How_can_I_use_these_extra_packages.3F|enable EPEL]], then run this as <code>root</code>:
t
 
<pre>yum --enablerepo=epel-testing install nodejs npm</pre>
<pre>yum install nodejs npm</pre>


== Installing Node.js Libraries and Programs ==
== Installing Node.js Libraries and Programs ==
Line 46: Line 52:


<pre>sudo yum install 'npm(express)'</pre>
<pre>sudo yum install 'npm(express)'</pre>
=== Using modules installed via yum ===
Just use [https://npmjs.org/doc/link.html <code>npm link</code>].  For instance:
<pre>npm link express</pre>
Please note that you cannot just <code>require()</code> modules without explicitly linking them, and this is by design.  For more information, see [https://npmjs.org/doc/faq.html#I-installed-something-globally-but-I-can-t-require-it ''I installed something globally, but I can't <code>require()</code> it'' in the npm FAQ].
If you really want this behavior, [http://nodejs.org/api/modules.html#modules_loading_from_the_global_folders you can set <code>$NODE_PATH</code>] as follows:
<pre>export NODE_PATH=/usr/lib/node_modules</pre>


== Help! ==
== Help! ==


Got a question about Node.js that's specific to Fedora?  [https://admin.fedoraproject.org/mailman/listinfo/nodejs Ask us on our mailing list] or head on over to [[https://ask.fedoraproject.org/ Ask Fedora].
Got a question about Node.js that's specific to Fedora?  [https://admin.fedoraproject.org/mailman/listinfo/nodejs Ask us on our mailing list] or head on over to [https://ask.fedoraproject.org/ Ask Fedora].


[http://nodejs.org/community/ Node.js also has a fantastic community that's there to help.]
[http://nodejs.org/community/ Node.js also has a fantastic community that's there to help.]
Line 55: Line 73:
== Join Us! ==
== Join Us! ==


Your favorite Node.js module isn't packaged for Fedora yet?  [[Join the package collection maintainers|''You'' can fix that!]]
Your favorite Node.js module isn't packaged for Fedora yet?  [https://docs.fedoraproject.org/en-US/package-maintainers/Joining_the_Package_Maintainers/ ''You'' can fix that!]


Already a Fedora contributor?  [[Node.js/Packagers|Learn everything you need to know about packaging Node programs.]]
Already a Fedora contributor?  [[Node.js/Packagers|Learn everything you need to know about packaging Node programs.]]


Who are we?  [[SIGs/Node.js|Learn more about the Fedora Node.js Special Interest Group.]]
Who are we?  [[SIGs/Node.js|Learn more about the Fedora Node.js Special Interest Group.]]

Latest revision as of 16:56, 7 October 2021

Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

npm is the package manager for the Node JavaScript platform. The npm registry contains over 20,000 libraries and programs available under free and open source licenses, many of which are also now available in Fedora.


Why Node.js?

Check out this Node.js guide, or let Node.js creator Ryan Dahl explain it to you in this video.

Just want the "Hello, world!"? Here you go.

Why Fedora?

We can explain it to you in 4 Fs.

Installing Node.js and npm

Fedora 18 - 21

Look for the nodejs and npm packages in your favorite graphical package manager, or run this:

sudo yum install nodejs npm

Can't wait for the latest and greatest version of node? Grab it from updates-testing.

Fedora 22 and newer

One can use a graphical package manager and search for nodejs or run:

sudo dnf install nodejs

RHEL 6 and friends

Node.js and npm are currently available from the Fedora Extra Packages for Enterprise Linux (EPEL) repository. If you haven't already done so, enable EPEL, then run this as root:

yum install nodejs npm

Installing Node.js Libraries and Programs

There are a bunch of cool Node.js libraries and programs already available in Fedora. Check out Node.js packager Jamie Nguyen's recent blog post listing some of these awesome packages. If that's not enough, the npm registry contains over 20,000 libraries and programs, all available under free and open source licenses.

Installing npm packages via yum

Know the npm package name and want to install it with yum? Just do this:

sudo yum install 'npm(package-name)'

For instance, to install express, a popular web application framework, run:

sudo yum install 'npm(express)'

Using modules installed via yum

Just use npm link. For instance:

npm link express

Please note that you cannot just require() modules without explicitly linking them, and this is by design. For more information, see I installed something globally, but I can't require() it in the npm FAQ.

If you really want this behavior, you can set $NODE_PATH as follows:

export NODE_PATH=/usr/lib/node_modules

Help!

Got a question about Node.js that's specific to Fedora? Ask us on our mailing list or head on over to Ask Fedora.

Node.js also has a fantastic community that's there to help.

Join Us!

Your favorite Node.js module isn't packaged for Fedora yet? You can fix that!

Already a Fedora contributor? Learn everything you need to know about packaging Node programs.

Who are we? Learn more about the Fedora Node.js Special Interest Group.