isaacs/npm — Issue #1987: segmentation fault installing npm with node v0.6.6 installed with homebrew
Author: stepheneb
Created: 2012-01-04 17:47:01+00:00
State: open

On Mac OSX 10.6.8 I'm getting a segmentation fault installing npm with node v0.6.6 installed with homebrew.

Remove node and node_modules and npm:

cd /usr/local
brew remove --force node
sudo rm -rf lib/node_modules
rm -f bin/npm

Install node:

$ brew install node
==> Downloading http://nodejs.org/dist/v0.6.6/node-v0.6.6.tar.gz
File already downloaded in /Users/stephen/Library/Caches/Homebrew
==> ./configure --prefix=/usr/local/Cellar/node/0.6.6 --without-npm
==> make install
==> Caveats
Homebrew has NOT installed npm. We recommend the following method of
installation:
curl http://npmjs.org/install.sh | sh

After installing, add the following path to your NODE_PATH environment
variable to have npm libraries picked up:
/usr/local/lib/node_modules
==> Summary
/usr/local/Cellar/node/0.6.6: 80 files, 7.5M, built in 4.1 minutes

Node seems to be installed:

$ node -v
v0.6.6

Try installing NPM:

$ curl http://npmjs.org/install.sh | sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
101 7881 101 7881 0 0 54223 0 --:--:-- --:--:-- --:--:-- 108k
tar=/usr/bin/tar
version:
bsdtar 2.6.2 - libarchive 2.6.2
install npm@1.1
fetching: http://registry.npmjs.org/npm/-/npm-1.1.0-beta-7.tgz
npm-install-27918.sh: line 302: 27949 Segmentation fault "$node" node_modules/semver/bin/semver -v "$node_version" -r "$req"
You need node to run this program.
node --version reports: v0.6.6
Please upgrade node before continuing.
It failed

OK, clone npm and try installing from the git repo:

$ cd npm
$ git log -1
commit 869813f4af39fc28c5d32671afe9bd395008e668
Author: isaacs
Date: Mon Jan 2 09:31:27 2012 -0800

Switch npm install based on node version

$ sudo make install
! [ -d .git ] || git submodule update --init --recursive
scripts/doc-build.sh doc/api/author.md man/man3/author.3

The install seems to be stuck here ... how long should doc-build.sh take?

$ psg doc
root 30961 0.0 0.0 2435544 800 s010 S+ 12:41PM 0:00.05 /bin/bash scripts/doc-build.sh doc/api/author.md man/man3/author.3