Translate

Image of Advanced Programming in the UNIX Environment, Second Edition (Addison-Wesley Professional Computing Series)
Image of Operating System Concepts
Image of RHCE Red Hat Certified Engineer Linux Study Guide (Exam RH302) (Certification Press)
Image of Modern Operating Systems (3rd Edition)

Creating RPMs for Node.js and NPM on Fedora

While JavaScript engines and shells have been available outside of the browser for many years, it was really only when Google released their V8 JavaScript engine in 2008 that the much of the software development world started to wake up to the possibilities of using JavaScript as a standalone server-side scripting language.

As a result, a number of JavaScript toolkits and application frameworks based on V8 have emerged in the last couple of years including Node.js, EJScript, Firecat and Appweb. Another impetus for such toolkits and frameworks is the fact that in recent years JavaScript has become faster and more efficient than many of the other popular scripting languages for non platform dependant tasks and is well on its way to becoming a major universal scripting language.

The stated goal of Node,js is to provide an easy way to build scalable network applications. It includes many useful JavaScript libraries to access to the network and underlying filesystem. However its key feature is evented I/O. Node.js takes the approach that all I/O should be non-blocking. This means that HTTP requests, database queries, file I/O and suchlike do not block. They are asynchronous, run independently and emit an event when necessary via callbacks.

A whole collection of libraries and application frameworks has emerged based on Node.js. Check out the github Node.js page which lists many of the popular Node.js libraries (AKA modules.) This has lead to the development of a number of package managers for Node.js packages including NPM, SeedJS and Kiwi.

NPM (Node.js Package Manager) is currently the defacto package manager for Node.js. It is a command line tool for installing, updating and managing Node.js packages. It works much like the Ruby (RubyGems), Perl and Python package managers in that it does not use the underlying platform package manager. Instead it maintains its own package repository.

A NPM package is:

  • A folder (a) containing a program or library described by a package.json file
  • A gzipped tarball (b) containing the folder (a)
  • A URL (c) that resolves to (b)
  • A <name>@<version> (d) that is published on the registry with (c)
  • A <name>@<tag> (e) that points to (d)
  • A <name> that has a “latest” tag satisfying (e)

Currently there are no official Fedora RPMs for node.JS or NPM. There are some experimental RPMs but I found them all to be deficient in one way or another. This post will show you how to build what I consider to be suitable RPMs for use on Fedora platforms.

However, first of all, let me show you a typical example of installing node.JS using a shell script:

wget http://nodejs.org/dist/node-v0.2.5.tar.gz
 
tar xvf node-v0.2.5.tar.gz
cd node-v0.2.5
./configure
make
sudo make install


Here is a list of the files that make install installs:

* installing deps/libeio/eio.h as /usr/local/include/node/eio.h
* installing deps/v8/include/v8-profiler.h as /usr/local/include/node/v8-profiler.h
* installing deps/v8/include/v8-debug.h as /usr/local/include/node/v8-debug.h
* installing deps/v8/include/v8.h as /usr/local/include/node/v8.h
* installing deps/libev/ev.h as /usr/local/include/node/ev.h
* installing build/default/config.h as /usr/local/include/node/config.h
* installing src/node.h as /usr/local/include/node/node.h
* installing src/node_object_wrap.h as /usr/local/include/node/node_object_wrap.h
* installing src/node_buffer.h as /usr/local/include/node/node_buffer.h
* installing src/node_events.h as /usr/local/include/node/node_events.h
* installing src/node_version.h as /usr/local/include/node/node_version.h
* installing doc/node.1 as /usr/local/share/man/man1/node.1
* installing bin/node-waf as /usr/local/bin/node-waf
* installing bin/node-repl as /usr/local/bin/node-repl
* installing tools/wafadmin/Build.py as /usr/local/lib/node/wafadmin/Build.py
* installing tools/wafadmin/Constants.py as /usr/local/lib/node/wafadmin/Constants.py
* installing tools/wafadmin/py3kfixes.py as /usr/local/lib/node/wafadmin/py3kfixes.py
* installing tools/wafadmin/Task.py as /usr/local/lib/node/wafadmin/Task.py
* installing tools/wafadmin/Scripting.py as /usr/local/lib/node/wafadmin/Scripting.py
* installing tools/wafadmin/Configure.py as /usr/local/lib/node/wafadmin/Configure.py
* installing tools/wafadmin/Options.py as /usr/local/lib/node/wafadmin/Options.py
* installing tools/wafadmin/Runner.py as /usr/local/lib/node/wafadmin/Runner.py
* installing tools/wafadmin/ansiterm.py as /usr/local/lib/node/wafadmin/ansiterm.py
* installing tools/wafadmin/__init__.py as /usr/local/lib/node/wafadmin/__init__.py
* installing tools/wafadmin/Environment.py as /usr/local/lib/node/wafadmin/Environment.py
* installing tools/wafadmin/TaskGen.py as /usr/local/lib/node/wafadmin/TaskGen.py
* installing tools/wafadmin/pproc.py as /usr/local/lib/node/wafadmin/pproc.py
* installing tools/wafadmin/Utils.py as /usr/local/lib/node/wafadmin/Utils.py
* installing tools/wafadmin/Logs.py as /usr/local/lib/node/wafadmin/Logs.py
* installing tools/wafadmin/Node.py as /usr/local/lib/node/wafadmin/Node.py
* installing tools/wafadmin/Tools/config_c.py as /usr/local/lib/node/wafadmin/Tools/config_c.py
* installing tools/wafadmin/Tools/icc.py as /usr/local/lib/node/wafadmin/Tools/icc.py
* installing tools/wafadmin/Tools/gxx.py as /usr/local/lib/node/wafadmin/Tools/gxx.py
* installing tools/wafadmin/Tools/nasm.py as /usr/local/lib/node/wafadmin/Tools/nasm.py
* installing tools/wafadmin/Tools/dmd.py as /usr/local/lib/node/wafadmin/Tools/dmd.py
* installing tools/wafadmin/Tools/suncc.py as /usr/local/lib/node/wafadmin/Tools/suncc.py
* installing tools/wafadmin/Tools/gas.py as /usr/local/lib/node/wafadmin/Tools/gas.py
* installing tools/wafadmin/Tools/gcc.py as /usr/local/lib/node/wafadmin/Tools/gcc.py
* installing tools/wafadmin/Tools/compiler_d.py as /usr/local/lib/node/wafadmin/Tools/compiler_d.py
* installing tools/wafadmin/Tools/gob2.py as /usr/local/lib/node/wafadmin/Tools/gob2.py
* installing tools/wafadmin/Tools/suncxx.py as /usr/local/lib/node/wafadmin/Tools/suncxx.py
* installing tools/wafadmin/Tools/misc.py as /usr/local/lib/node/wafadmin/Tools/misc.py
* installing tools/wafadmin/Tools/node_addon.py as /usr/local/lib/node/wafadmin/Tools/node_addon.py
* installing tools/wafadmin/Tools/cc.py as /usr/local/lib/node/wafadmin/Tools/cc.py
* installing tools/wafadmin/Tools/d.py as /usr/local/lib/node/wafadmin/Tools/d.py
* installing tools/wafadmin/Tools/xlcxx.py as /usr/local/lib/node/wafadmin/Tools/xlcxx.py
* installing tools/wafadmin/Tools/__init__.py as /usr/local/lib/node/wafadmin/Tools/__init__.py
* installing tools/wafadmin/Tools/ar.py as /usr/local/lib/node/wafadmin/Tools/ar.py
* installing tools/wafadmin/Tools/gdc.py as /usr/local/lib/node/wafadmin/Tools/gdc.py
* installing tools/wafadmin/Tools/libtool.py as /usr/local/lib/node/wafadmin/Tools/libtool.py
* installing tools/wafadmin/Tools/osx.py as /usr/local/lib/node/wafadmin/Tools/osx.py
* installing tools/wafadmin/Tools/python.py as /usr/local/lib/node/wafadmin/Tools/python.py
* installing tools/wafadmin/Tools/icpc.py as /usr/local/lib/node/wafadmin/Tools/icpc.py
* installing tools/wafadmin/Tools/gnu_dirs.py as /usr/local/lib/node/wafadmin/Tools/gnu_dirs.py
* installing tools/wafadmin/Tools/cxx.py as /usr/local/lib/node/wafadmin/Tools/cxx.py
* installing tools/wafadmin/Tools/intltool.py as /usr/local/lib/node/wafadmin/Tools/intltool.py
* installing tools/wafadmin/Tools/compiler_cxx.py as /usr/local/lib/node/wafadmin/Tools/compiler_cxx.py
* installing tools/wafadmin/Tools/unittestw.py as /usr/local/lib/node/wafadmin/Tools/unittestw.py
* installing tools/wafadmin/Tools/xlc.py as /usr/local/lib/node/wafadmin/Tools/xlc.py
* installing tools/wafadmin/Tools/ccroot.py as /usr/local/lib/node/wafadmin/Tools/ccroot.py
* installing tools/wafadmin/Tools/preproc.py as /usr/local/lib/node/wafadmin/Tools/preproc.py
* installing tools/wafadmin/Tools/winres.py as /usr/local/lib/node/wafadmin/Tools/winres.py
* installing tools/wafadmin/Tools/compiler_cc.py as /usr/local/lib/node/wafadmin/Tools/compiler_cc.py
* installing build/default/node as /usr/local/bin/node
* installing build/default/src/node_config.h as /usr/local/include/node/node_config.h


There are a number of documented ways to install NPM. Here is one way to download and install NPM:

# curl http://npmjs.org/install.sh | sh
node cli.js cache clean
npm info it worked if it ends with ok
npm info using npm@0.2.12-1
npm info using node@v0.2.5
npm ERR! sudon't! 
npm ERR! sudon't! Running npm as root is not recommended!
npm ERR! sudon't! Seriously, don't do this!
npm ERR! sudon't!
npm ok
node cli.js rm npm
npm info it worked if it ends with ok
npm info using npm@0.2.12-1
npm info using node@v0.2.5
npm ERR! sudon't! 
npm ERR! sudon't! Running npm as root is not recommended!
npm ERR! sudon't! Seriously, don't do this!
npm ERR! sudon't!
npm info not installed npm
npm ok
node cli.js install npm
npm info it worked if it ends with ok
npm info using npm@0.2.12-1
npm info using node@v0.2.5
npm ERR! sudon't! 
npm ERR! sudon't! Running npm as root is not recommended!
npm ERR! sudon't! Seriously, don't do this!
npm ERR! sudon't!
npm info fetch http://registry.npmjs.org/npm/-/npm-0.2.12-1.tgz
npm info calculating sha1 /tmp/npm-1292470427494/1292470427888-0.6498551466502249/tmp.tgz
npm info shasum a6a1d796735ac94fac62152e1b610b0041317703
npm info calculating sha1 /usr/local/lib/node/.npm/.cache/npm/0.2.12-1/package.tgz
npm info shasum 7c6c1c89a1b74333fe00d25d43ce4d2655a6bc7b
npm info preinstall npm@0.2.12-1
npm info install npm@0.2.12-1
npm info postinstall npm@0.2.12-1

Thanks for installing version 0.2.12-1 of npm.

Last few items from the changelog:

  shasums on all tarballs  
  More portable tar option usage  
  Much beefed up bundle command  
  Deep view command

* 0.2.10:
  npm edit command  
  various stability bugfixes.

* 0.2.11:
  ~> and 1.2.x style version ranges  
  complete tab completion: see `npm help completion` (Evan Meagher)  
  explore command: see `npm help explore`  
  docs command: see `npm help docs`  
  keywords and description in `npm ls`  
  Frequently asked questions at `npm help faq`

* 0.2.12:
  Various bugfixes (0.2.11 was big, broke some stuff)  
  `npm faq` command (wrapper for `npm help faq`)

npm info preactivate npm@0.2.12-1
npm info activate npm@0.2.12-1
npm info postactivate npm@0.2.12-1
npm info build Success: npm@0.2.12-1
npm ok
It worked

it was installed in /usr/local/bin/npm


As you can see neither Node.js or NPM install in ways that most people are used to on Fedora.

I decided to develop separate RPMs for installing Node.js and NPM. I am not, however, going to discuss how to build RPMs in general. I assume that you already know how to do that if you are reading this post. If not, there are plenty of good tutorials available of the Internet.

The first problem that emerged is that there is an pre-existing package called node for most GNU/Linux distributions. Unfortunately the lead Node.js developer, Ryan Dahl, insists on calling his application node. His attitude to this problem is interesting:

I want Node to have the executable name ‘node’. You can contact the author of the other package and see if they’ll change their name.

Ah, the arrogance of youth!

I, for one, think that Fedora should follow the lead of Debian and rename it to nodejs to avoid confusion. This is what I have done in the two RPMs that I developed.

As a result of this decision, the executable /usr/bin/node is renamed to /usr/bin/nodejs, scripts containing shebangs are modified from #!/usr/bin/env node to #!/usr/bin/nodejs and /usr/lib/nodejs replaces /usr/lib/nodejs. The default NPM configuration options file ../lib/utils/default-config.js is modified to set sane defaults for the Fedora platform, and a global configuration file /etc/npmrc is created. See the .spec files for details.

I do not see a valid reason for separate 64-bit and 32-bit libraries at this time but the issue may need revisiting in the future.

Here is the .spec file for node.js

Name:           nodejs

Version:        0.3.1
Release:        1.0

Summary:        Node.js
Group:          Development/Languages/Other
License:        MIT
URL:            http://nodejs.org/

Source0:        node-v%{version}.tar.gz

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires:  gcc-c++ >= 4.1
BuildRequires:  libstdc++-devel
BuildRequires:  python
BuildRequires:  openssl-devel

Provides:       nodejs
Obsoletes:      nodejs

%description
Evented I/O for Google V8 JavaScript


%package devel
Summary:        Node.js development files
Group:          Development/Languages/C and C++
Requires:       %{name} = %{version}-%{release}
Requires:       python
Requires:       gcc-c++ >= 4.1


%description devel
This package contains files for node.js addons development and build

%clean
rm -rf %{buildroot}


%prep
%setup -q -n node-v%{version}


%build
./configure --debug --prefix=%{_prefix}
sed -i -e 's|"lib", "node"|"lib", "nodejs"|' src/node.js
%__make %{?_smp_mflags} CXXFLAGS="%{optflags}" CFLAGS="%{optflags}"

%install
%__make DESTDIR=%{buildroot} install
mv ${RPM_BUILD_ROOT}%{_bindir}/node ${RPM_BUILD_ROOT}%{_bindir}/nodejs
mv ${RPM_BUILD_ROOT}%{_bindir}/node_g ${RPM_BUILD_ROOT}%{_bindir}/nodejs_g
mv ${RPM_BUILD_ROOT}%{_includedir}/node ${RPM_BUILD_ROOT}%{_includedir}/nodejs
mv ${RPM_BUILD_ROOT}%{_prefix}/lib/node ${RPM_BUILD_ROOT}%{_prefix}/lib/nodejs
mv ${RPM_BUILD_ROOT}%{_mandir}/man1/node.1 ${RPM_BUILD_ROOT}%{_mandir}/man1/nodejs.1


%files
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog LICENSE
%attr(755,root,root) %{_bindir}/nodejs
%{_mandir}/man1/nodejs.1.gz

%files devel
%defattr(-,root,root,-)
# Headers
%dir %{_includedir}/nodejs
%{_includedir}/nodejs/*
# Debug version of node
%attr(755,root,root) %{_bindir}/nodejs_g
# Package information
%{_prefix}/lib/pkgconfig/nodejs.pc
# Node-waf
%attr(755,root,root) %{_bindir}/node-waf
%dir %{_prefix}/lib/nodejs
%dir %{_prefix}/lib/nodejs/wafadmin
%dir %{_prefix}/lib/nodejs/wafadmin/Tools
%{_prefix}/lib/nodejs/wafadmin/*


%changelog
* Sat Dec 18 2010 Finnbarr P. Murphy <fpm@fpmurphy.com> - 0.3.1
- First release. Contains node.JS v0.3.1

And here is the .spec file for NPM:

Name:           npm

Version:        0.2.9
Release:        1.0

Summary:        A package manager for node.js
Group:          Development/Libraries/Other
License:        MIT
URL:            http://npmjs.org/

%define realversion 0.2.9

Source0:        npm-v%{realversion}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root

BuildRequires:  nodejs
Requires:       nodejs
BuildArch:      noarch
%description
NPM is a package manager for node.js.

%prep
%setup -q -n npm-v%{realversion}


%clean
rm -rf %{buildroot}


%build


%install
# control the NPM install locations
cat > /var/tmp/npmrc <<NPMRC
root = %{buildroot}/usr/lib/nodejs
binroot = %{buildroot}%{_bindir}
manroot = %{buildroot}%{_mandir}
loglevel = verbose
tmpdir = /var/tmp
NPMRC
npm_config_userconfig=/var/tmp/npmrc nodejs cli.js install .
rm -f /var/tmp/npmrc

# Replace NPM manpage symlinks with normal files
buildroot_escaped=`echo '%{buildroot}' | sed -e 's/\\//\\\\\\//g'`
realversion_escaped=`echo '%{realversion}' | sed -e 's/\\//\\\\\\//g'`
mandir_escaped=`echo '%{_mandir}' | sed -e 's/\\//\\\\\\//g'`
rm %{buildroot}%{_mandir}/man1/*
mv %{buildroot}/usr/lib/nodejs/.npm/npm/%{realversion}/package/man1/npm.1 %{buildroot}%{_mandir}/man1/npm.1
ls -l %{buildroot}/usr/lib/nodejs/.npm/npm/%{realversion}/package/man1/*.1 | sed -e "s/.*\/\(.*\)$/cp ${buildroot_escaped}\/usr\/lib\/nodejs\/.npm\/npm\/${realversion_escaped}\/package\/man1\/\1 ${buildroot_escaped}${mandir_escaped}\/man1\/npm-\1/g" | bash
rm %{buildroot}%{_bindir}/npm
mv %{buildroot}%{_bindir}/npm@%{realversion} %{buildroot}%{_bindir}/npm

rm -r %{buildroot}/usr/lib/nodejs/npm
mv %{buildroot}/usr/lib/nodejs/npm@%{realversion} %{buildroot}/usr/lib/nodejs/npm

rm -f %{buildroot}/usr/lib/nodejs/.npm/npm/%{realversion}/package/.gitignore
chmod -x %{buildroot}/usr/lib/nodejs/.npm/npm/%{realversion}/package/test/packages/bindir/test.js

# configure NPM defaults in ../libs/utils/default-config.js for Fedora/Redhat/Centos platforms
sed -i -e 's|\(^  , root : \)\(.*\)|\1"/usr/lib/nodejs"|' -e 's|\(^  , tmproot : \)\(.*\)|\1"/var/tmp"|' -e 's|\(^  , manroot : \)\(.*\)|\1"/usr/share/man"|' -e 's|\(^  , binroot : \)\(.*\)|\1"/usr/bin"|' -e 's|\(^  , globalconfig : \)\(.*\)|\1"/etc/npmrc"|'  %{buildroot}/usr/lib/nodejs/.npm/npm/%{realversion}/package/lib/utils/default-config.js

# fix up hashbangs to up /usr/bin/nodejs
sed -i -e 's|/usr/bin/env node|/usr/bin/nodejs|' %{buildroot}/usr/bin/npm
sed -i -e 's|/usr/bin/env node|/usr/bin/nodejs|' %{buildroot}/usr/lib/nodejs/.npm/npm/%{realversion}/package/lib/utils/write-shim.js
sed -i -e 's|/usr/bin/env node|/usr/bin/nodejs|' %{buildroot}/usr/lib/nodejs/.npm/npm/%{realversion}/package/cli.js
# add an /etc/npmrc config file
mkdir -p %{buildroot}/etc
cat > %{buildroot}/etc/npmrc <<NPMRC
root = /usr/lib/nodejs
binroot = /usr/bin
manroot = /usr/share/man
tmproot = /var/tmp
loglevel = error
NPMRC

%files
%defattr(-,root,root,-)
%exclude /usr/lib/nodejs/.npm/.cache
%dir /usr/lib/nodejs/npm
/usr/lib/nodejs/npm/*
%dir /usr/lib/nodejs/.npm
/usr/lib/nodejs/.npm/*
%attr(755,root,root) %{_bindir}/npm
%{_mandir}/man1/*
/etc/npmrc

%changelog
* Mon Dec 20 2010 Finnbarr P. Murphy <fpm@fpmurphy.com> 0.2.9-1 
- Initial RPM packaging of NPM v0.2.9


These RPM packages should not be regarded as production ready as they have not been extensively tested or reviewed. I am not an RPM build expert by any means! I did not create the above .spec files from scratch. Instead I modified the .spec files for existing RPMs that I found on OBS (OpenSUSE Build Service). The bRPMs appear to work as intended.

If you do not want to build your own RPMs, you can download built RPMs for a number of platforms them from my project area on OBS. Just pick the project you want (nodejs or NPM) followed by the build platform (under build status), and you will be taken to the appropriate download repository. Note Fedora 14 is not yet available as an operational build platform on OBS as the build hosts need upgrading. However, with Novell being recently sold off to Attachmate Corporation, I wonder will this ever occur! Meanwhile you can download the two Fedora 14 RPMs for X86_64 platforms from fpmurphy.com.

Here are a list of the files installed by both packages:

# rpm -vi nodejs-0.3.1-1.0.x86_64.rpm
Preparing packages for installation...
nodejs-0.3.1-1.0
#
# rpm -ql nodejs
/usr/bin/nodejs
/usr/share/doc/nodejs-0.3.1
/usr/share/doc/nodejs-0.3.1/AUTHORS
/usr/share/doc/nodejs-0.3.1/ChangeLog
/usr/share/doc/nodejs-0.3.1/LICENSE
/usr/share/man/man1/nodejs.1.gz
#
# rpm -vi npm-0.2.9-1.0.noarch.rpm
Preparing packages for installation...
npm-0.2.9-1.0
#
# rpm -ql npm
/etc/npmrc
/usr/bin/npm
/usr/lib/nodejs/.npm
/usr/lib/nodejs/.npm/npm
/usr/lib/nodejs/.npm/npm/0.2.9
/usr/lib/nodejs/.npm/npm/0.2.9/package
/usr/lib/nodejs/.npm/npm/0.2.9/package/.npmignore
/usr/lib/nodejs/.npm/npm/0.2.9/package/LICENSE
/usr/lib/nodejs/.npm/npm/0.2.9/package/Makefile
/usr/lib/nodejs/.npm/npm/0.2.9/package/README.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/cli.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/activate.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/adduser.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/build.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/bundle.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/cache.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/changelog.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/coding-style.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/config.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/deactivate.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/deprecate.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/developers.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/folders.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/future-ideas
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/future-ideas/deploy.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/future-ideas/remote.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/future-ideas/site.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/init.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/install.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/json.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/link.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/list.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/ln.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/ls.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/npm.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/outdated.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/owner.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/publish.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/rebuild.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/restart.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/rm.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/scripts.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/start.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/stop.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/tag.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/test.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/uninstall.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/unpublish.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/update.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/version.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/doc/view.md
/usr/lib/nodejs/.npm/npm/0.2.9/package/html
/usr/lib/nodejs/.npm/npm/0.2.9/package/html/favicon.ico
/usr/lib/nodejs/.npm/npm/0.2.9/package/html/index.html
/usr/lib/nodejs/.npm/npm/0.2.9/package/html/npm-16.png
/usr/lib/nodejs/.npm/npm/0.2.9/package/html/npm-64-square.png
/usr/lib/nodejs/.npm/npm/0.2.9/package/html/npm-fin.png
/usr/lib/nodejs/.npm/npm/0.2.9/package/html/npm-large.png
/usr/lib/nodejs/.npm/npm/0.2.9/package/html/npm.png
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/activate.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/adduser.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/autoremove.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/build.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/bundle.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/cache.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/completion.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/config.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/deactivate.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/deprecate.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/help.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/init.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/install.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/link.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/ls.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/outdated.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/owner.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/publish.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/rebuild.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/repl.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/restart.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/start.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/stop.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/tag.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/test.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/uninstall.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/unpublish.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/update-dependents.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/update.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/abbrev.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/async-map.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/base64.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/chain.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/default-config.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/default.npmignore
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/error-handler.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/exec.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/fetch.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/find.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/get.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/graceful-fs.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/ini-parser.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/ini.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/lifecycle.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/link.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/load-package-defaults.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/log.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/mkdir-p.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/output.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/promise-chain.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/prompt.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/proto-list.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/read-installed.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/read-json.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/registry
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/registry.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/registry/adduser.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/registry/get.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/registry/publish.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/registry/request.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/registry/tag.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/registry/unpublish.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/relativize.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/rm-rf.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/semver.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/set.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/sha.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/sys.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/uuid.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/utils/write-shim.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/version.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/lib/view.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/activate.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/adduser.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/build.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/bundle.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/cache.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/changelog.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/coding-style.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/config.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/deactivate.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/deprecate.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/developers.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/folders.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/future-ideas
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/future-ideas/deploy.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/future-ideas/remote.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/future-ideas/site.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/init.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/install.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/json.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/link.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/list.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/ln.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/ls.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/outdated.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/owner.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/publish.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/rebuild.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/restart.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/rm.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/scripts.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/start.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/stop.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/tag.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/test.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/uninstall.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/unpublish.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/update.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/version.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/man1/view.1
/usr/lib/nodejs/.npm/npm/0.2.9/package/npm-completion.sh
/usr/lib/nodejs/.npm/npm/0.2.9/package/npm.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/package.json
/usr/lib/nodejs/.npm/npm/0.2.9/package/scripts
/usr/lib/nodejs/.npm/npm/0.2.9/package/scripts/install.sh
/usr/lib/nodejs/.npm/npm/0.2.9/package/test
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/common.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/disabled
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/disabled/failer
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/disabled/failer/package.json
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/disabled/fast
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/disabled/fast/package.json
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/disabled/slow
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/disabled/slow/package.json
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/packages
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/packages/bindir
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/packages/bindir/bin
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/packages/bindir/bin/prog.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/packages/bindir/package.json
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/packages/bindir/test.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/packages/blerg
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/packages/blerg/package.json
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/packages/blerg/test.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/packages/bundlerecurs
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/packages/bundlerecurs/package.json
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/packages/bundletest
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/packages/bundletest/foo.js
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/packages/bundletest/package.json
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/packages/depends-on-connect
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/packages/depends-on-connect/package.json
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/packages/depends-on-jsdom
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/packages/depends-on-jsdom/package.json
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/packages/env-reader
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/packages/env-reader/package.json
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/packages/test-package
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/packages/test-package/package.json
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/run.sh
/usr/lib/nodejs/.npm/npm/0.2.9/package/test/update-test.sh
/usr/lib/nodejs/.npm/npm/active
/usr/lib/nodejs/npm
/usr/lib/nodejs/npm/activate.js
/usr/lib/nodejs/npm/adduser.js
/usr/lib/nodejs/npm/autoremove.js
/usr/lib/nodejs/npm/build.js
/usr/lib/nodejs/npm/bundle.js
/usr/lib/nodejs/npm/cache.js
/usr/lib/nodejs/npm/completion.js
/usr/lib/nodejs/npm/config.js
/usr/lib/nodejs/npm/deactivate.js
/usr/lib/nodejs/npm/deprecate.js
/usr/lib/nodejs/npm/help.js
/usr/lib/nodejs/npm/index.js
/usr/lib/nodejs/npm/init.js
/usr/lib/nodejs/npm/install.js
/usr/lib/nodejs/npm/link.js
/usr/lib/nodejs/npm/ls.js
/usr/lib/nodejs/npm/outdated.js
/usr/lib/nodejs/npm/owner.js
/usr/lib/nodejs/npm/publish.js
/usr/lib/nodejs/npm/rebuild.js
/usr/lib/nodejs/npm/repl.js
/usr/lib/nodejs/npm/restart.js
/usr/lib/nodejs/npm/start.js
/usr/lib/nodejs/npm/stop.js
/usr/lib/nodejs/npm/tag.js
/usr/lib/nodejs/npm/test.js
/usr/lib/nodejs/npm/uninstall.js
/usr/lib/nodejs/npm/unpublish.js
/usr/lib/nodejs/npm/update-dependents.js
/usr/lib/nodejs/npm/update.js
/usr/lib/nodejs/npm/utils
/usr/lib/nodejs/npm/utils/abbrev.js
/usr/lib/nodejs/npm/utils/async-map.js
/usr/lib/nodejs/npm/utils/base64.js
/usr/lib/nodejs/npm/utils/chain.js
/usr/lib/nodejs/npm/utils/default-config.js
/usr/lib/nodejs/npm/utils/default.js
/usr/lib/nodejs/npm/utils/error-handler.js
/usr/lib/nodejs/npm/utils/exec.js
/usr/lib/nodejs/npm/utils/fetch.js
/usr/lib/nodejs/npm/utils/find.js
/usr/lib/nodejs/npm/utils/get.js
/usr/lib/nodejs/npm/utils/graceful-fs.js
/usr/lib/nodejs/npm/utils/ini-parser.js
/usr/lib/nodejs/npm/utils/ini.js
/usr/lib/nodejs/npm/utils/lifecycle.js
/usr/lib/nodejs/npm/utils/link.js
/usr/lib/nodejs/npm/utils/load-package-defaults.js
/usr/lib/nodejs/npm/utils/log.js
/usr/lib/nodejs/npm/utils/mkdir-p.js
/usr/lib/nodejs/npm/utils/output.js
/usr/lib/nodejs/npm/utils/promise-chain.js
/usr/lib/nodejs/npm/utils/prompt.js
/usr/lib/nodejs/npm/utils/proto-list.js
/usr/lib/nodejs/npm/utils/read-installed.js
/usr/lib/nodejs/npm/utils/read-json.js
/usr/lib/nodejs/npm/utils/registry
/usr/lib/nodejs/npm/utils/registry.js
/usr/lib/nodejs/npm/utils/registry/adduser.js
/usr/lib/nodejs/npm/utils/registry/get.js
/usr/lib/nodejs/npm/utils/registry/publish.js
/usr/lib/nodejs/npm/utils/registry/request.js
/usr/lib/nodejs/npm/utils/registry/tag.js
/usr/lib/nodejs/npm/utils/registry/unpublish.js
/usr/lib/nodejs/npm/utils/relativize.js
/usr/lib/nodejs/npm/utils/rm-rf.js
/usr/lib/nodejs/npm/utils/semver.js
/usr/lib/nodejs/npm/utils/set.js
/usr/lib/nodejs/npm/utils/sha.js
/usr/lib/nodejs/npm/utils/sys.js
/usr/lib/nodejs/npm/utils/uuid.js
/usr/lib/nodejs/npm/utils/write-shim.js
/usr/lib/nodejs/npm/version.js
/usr/lib/nodejs/npm/view.js
/usr/share/man/man1/npm-activate.1.gz
/usr/share/man/man1/npm-adduser.1.gz
/usr/share/man/man1/npm-build.1.gz
/usr/share/man/man1/npm-bundle.1.gz
/usr/share/man/man1/npm-cache.1.gz
/usr/share/man/man1/npm-changelog.1.gz
/usr/share/man/man1/npm-coding-style.1.gz
/usr/share/man/man1/npm-config.1.gz
/usr/share/man/man1/npm-deactivate.1.gz
/usr/share/man/man1/npm-deprecate.1.gz
/usr/share/man/man1/npm-developers.1.gz
/usr/share/man/man1/npm-folders.1.gz
/usr/share/man/man1/npm-init.1.gz
/usr/share/man/man1/npm-install.1.gz
/usr/share/man/man1/npm-json.1.gz
/usr/share/man/man1/npm-link.1.gz
/usr/share/man/man1/npm-list.1.gz
/usr/share/man/man1/npm-ln.1.gz
/usr/share/man/man1/npm-ls.1.gz
/usr/share/man/man1/npm-outdated.1.gz
/usr/share/man/man1/npm-owner.1.gz
/usr/share/man/man1/npm-publish.1.gz
/usr/share/man/man1/npm-rebuild.1.gz
/usr/share/man/man1/npm-restart.1.gz
/usr/share/man/man1/npm-rm.1.gz
/usr/share/man/man1/npm-scripts.1.gz
/usr/share/man/man1/npm-start.1.gz
/usr/share/man/man1/npm-stop.1.gz
/usr/share/man/man1/npm-tag.1.gz
/usr/share/man/man1/npm-test.1.gz
/usr/share/man/man1/npm-uninstall.1.gz
/usr/share/man/man1/npm-unpublish.1.gz
/usr/share/man/man1/npm-update.1.gz
/usr/share/man/man1/npm-version.1.gz
/usr/share/man/man1/npm-view.1.gz
/usr/share/man/man1/npm.1.gz


Here is a simple program to test the Node.js installation. It simply outputs the contents of the NPM global configuration file /etc/npmrc
~
To test NPM, you could, for example, install the expressjs application framework for Node.js:

# npm ls installed
npm@0.2.9   =isaacs active installed
npm ok
# npm install express
npm ok
# npm ls installed
connect@0.5.0   =creationix =tjholowaychuk active installed latest remote
express@1.0.0   =tjholowaychuk active installed latest remote
npm@0.2.9       =isaacs active installed
npm ok
# 


Here is the usual Hello World application using the express framework. You can use it to check that NPM correctly installed the express package and the dependency package connect and that Node.js can actually use them.

#!/usr/bin/nodejs

var express = require('express');

var app = express.createServer();

app.get('/', function(req, res){
  res.send('Hello World');
});

app.listen(3000);
console.log('Express server started on port %s', app.address().port);


In summary, it is possible to package Node.js and NPM in a manner that is consistent with the Fedora packaging guidelines. Server-side JavaScript implementations such as Node.js are an emerging technology which should be made available to users of Fedora and downstream distributions via the standard RPM package mechanism.
 

1 comment to Creating RPMs for Node.js and NPM on Fedora