Bash 101, $HOME/ivy/bin/node, not showing in the “require.paths” of node's environment

I'm trying to complete the following tutorial:

http://howtonode.org/deploying-node-with-spark

I've installed ivy and if I go cd $HOME/ivy/bin, then type in node, I'll get the node environment. However, after I add this to .profile:

PATH="$HOME/ivy/bin:$PATH"

I'll exit my session, log back in and here's what require.paths shows:

> require.paths
[ '/home/myusername/.node_modules',
  '/home/myusername/.node_libraries',
  '/usr/local/lib/node' ]

It is not picking up the '/home/myusername/ivy/lib/node' ... what's going on?

Answers


require.paths has been changed since July (when the article was published).

var modulePaths = [path.join(process.execPath, '..', '..', 'lib', 'node')];

if (process.env['HOME']) {
  modulePaths.unshift(path.join(process.env['HOME'], '.node_libraries'));
  modulePaths.unshift(path.join(process.env['HOME'], '.node_modules'));
}

if (process.env['NODE_PATH']) {
  modulePaths = process.env['NODE_PATH'].split(':').concat(modulePaths);
}

See: https://github.com/ry/node/blob/master/src/node.js#L133

You now need to define NODE_PATH and add the path(s) there:

# add ~/foo and ~/bla to the require.paths
export NODE_PATH=$HOME/foo:$HOME/bla

Results in:

> require.paths
[ '/home/ivo/foo',
  '/home/ivo/bla',
  '/home/ivo/.node_modules',
  '/home/ivo/.node_libraries',
  '/home/ivo/.local/lib/node' ]

Need Your Help

Performance of priority queue using an ArrayList

java performance arraylist

I'm currently working on a minimum priority queue that keeps itself sorted as items are added. The suggested implementation has new items added to the end of a sorted ArrayList, and then working b...

Hiding Groupings Only Containing 1 Element (in Sharepoint)

javascript jquery sharepoint

I have a list in Sharepoint that contains a few hundred groupings. Some groupings only contain 1 row, and in those cases, I want to removing the grouping header above.