5

On Mac 10.8.5, when I try installing Phonegap with

sudo npm install -g phonegap

or sudo-ing and running

npm install -g phonegap

I end up with

/Users/eric/Password:/usr/local/bin/phonegap ->    /Users/eric/Password:/usr/local/lib/node_modules/phonegap/bin/phonegap.js
phonegap@3.0.0-0.14.4 /Users/eric/Password:/usr/local/lib/node_modules/phonegap
├── pluralize@0.0.4
├── colors@0.6.0-1
├── semver@1.1.0
├── qrcode-terminal@0.9.4
├── shelljs@0.1.4
├── optimist@0.6.0 (minimist@0.0.5, wordwrap@0.0.2)
├── node-static@0.7.0 (colors@0.6.2, mime@1.2.11)
├── prompt@0.2.11 (revalidator@0.1.5, pkginfo@0.3.0, read@1.0.5, utile@0.2.0, winston@0.6.2)
├── phonegap-build@0.8.4 (qrcode-terminal@0.8.0, optimist@0.3.7, shelljs@0.0.9, phonegap-build-api@0.3.3)
└── cordova@3.0.9 (ncallbacks@1.0.0, open@0.0.3, colors@0.6.2, follow-redirects@0.0.3, shelljs@0.1.2, glob@3.2.6, tar@0.1.18, elementtree@0.1.3, xcode@0.5.1, prompt@0.2.7, express@3.0.0, request@2.22.0, ripple-emulator@0.9.18, npm@1.3.11, plist@0.4.3, plugman@0.11.0)

My versions of bash, node and npm are

bash-3.2# node --version
v0.10.19
bash-3.2# npm --version
1.3.11

Is this something I can fix at the commandline, by adding switchings or exporting variables, or is there something wrong in npm?

Thanks.

4

1 回答 1

8

Turns out something set my prefix for npm incorrectly; still not sure of the culprit.

But to fix this, I had to make sure the prefix matched the broken installation path, and that I was in the parent directory for that path, again.

For example

cd /Users/eric
npm set prefix /Users/eric/Password:/usr/local
sudo npm uninstall phonegap -g
sudo rm -rf Password\:/

Then I set the prefix to the default for OSX and ran the install again

npm set prefix /usr/local 
npm install -g phonegap
于 2013-09-30T19:43:22.823 回答