Joined November 2012

Gurjeet Singh


Posted to Install an npm module in a Meteor app over 1 year ago

Thanks for the tip!

On Ubuntu 12.04 I had to use this trick to get it to install:

sudo PATH=${PATH} $(which npm) install pg

I had to use sudo because the .meteor/local/build/server/nodemodules is a symbolic link to /usr/lib/meteor/lib/nodemodules which is owned by root.

I had to use PATH=${PATH} construct because sudo on Ubuntu is configured to reset the PATH to a smal list, and hence my PATH, which contained path to pg_config (required to build 'pg'), was lost. Doing PATH=${PATH} made sudo retain my PATH in the sudoed environment.

I used $(which npm) because npm is not installed system-wide, and is actually installed and managed by nvm (Node Version Manager). So the $(which npm) gave the exact path that sudo culd use to execute the binary, else sudo can't find npm (even though PATH=$PATH should've done this).

102 Karma
0 Total ProTip Views