File uploads in a Passenger-backed application fail

Overview A file upload initiated in an application written in Ruby, Node, or Python launched through Passenger will fail to upload. Thus far, the confirmed failure occurs in RefineryCMS with a generic undefined route message following upload. Cause It is a conflict between upload screening and Passenger, but the underlying cause is not clearly understood. Upload…

Spawning multiple TCP daemons in a single app

Overview Node applications may bind to a TCP port using listen(<PORT NUMBER>), provided of course the PORT NUMBER is one allocated to your account. Passenger replaces this listen() method with a built-in method that, instead of listening on a TCP port, creates a local UNIX socket for communication with the web server (see installServer() in source). By creating a socket, no…

Adding npm bin/ path to command search path

Overview npm installs packages by default under node_modules/ within the current working directory. Binary files, if bundled with a package, are installed under node_modules/.bin/ unless the global (-g) flag is supplied to npm install. This works if only a single version of a particular package is installed, but fails in most multi-version setups. Solution Add node_modules/.bin/…

Upgrade npm

Overview When attempting to install newer packages on v6+ platforms, npm may complain that it is too old to install a package. Sample error: Sails.js Installation – Error ——————————————————– Your npm-Version is too old: Sails require npm >= 1.4.0 (you currently have 1.3.6) Please update the installed npm (Node Package Manager) to install Sails. ——————————————————–…

Running Node.js

Overview Node.js is a performant JavaScript backend built off Chrome’s JavaScript engine (v8). It’s also wicked fast. Node.js and its accompanying package management, npm, are available on newer platforms (v6+) without any additional compilation from source. Accounts with terminal access are eligible to use Node.js and npm. Running Node.js with Passenger Newer hosting servers, v6+…