PhoneGap - Unable to install via npm, phonegap does not exist - node.js

I am trying to download and run PhoneGap. I have tried on 3 machines (2 mac, 1 windows), and I can't help but feel as though I am doing something wrong.
I have nodeJS (v0.10.13) and NPM (1.3.2) installed to the latest versions, using homebrew.
To install PhoneGap I do the following via commandline:
sudo npm install -g phonegap
NPM goes on it's merry way downloading a ton of packages and installing all without warning or error.
After install I get the following, which I assume is correct:
npm http 200 https://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz
/usr/local/share/npm/bin/phonegap -> /usr/local/share/npm/lib/node_modules/phonegap/bin/phonegap.js
phonegap#3.0.0-0.14.0 /usr/local/share/npm/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 (wordwrap#0.0.2, minimist#0.0.1)
├── node-static#0.7.0 (colors#0.6.0, mime#1.2.9)
├── phonegap-build#0.8.3 (qrcode-terminal#0.8.0, optimist#0.3.7, shelljs#0.0.9, phonegap-build-api#0.3.3)
├── prompt#0.2.11 (revalidator#0.1.5, pkginfo#0.3.0, read#1.0.5, winston#0.6.2, utile#0.2.0)
└── cordova#3.0.0 (ncallbacks#1.0.0, colors#0.6.0, open#0.0.3, shelljs#0.1.2, follow-redirects#0.0.3, elementtree#0.1.3, glob#3.2.3, plist#0.4.3, prompt#0.2.7, xcode#0.5.1, tar#0.1.17, express#3.0.0, ripple-emulator#0.9.18, plugman#0.9.10, request#2.22.0)
MikeBook-Pro:apps Mike$
I then restart terminal (completely quit it, cmd+q) and run phonegap, to be greeted with:
MikeBook-Pro:~ Mike$ phonegap
-bash: phonegap: command not found
I'm at my wits end here. I've installed other stuff through NPM without a problem. My /etc/paths looks like the following:
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
I have followed the above steps using cordova instead of phonegap, but alas; the same issue.
Any help is hugely appreciated, I just want to cry.
Edit: I'm currently trying this on OSX 10.8.2 (Mountain Lion)

I was some how missing a few paths from my /etc/paths file. Below is that new file:
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
/usr/local/share
/usr/local/share/npm
/usr/local/share/npm/lib/node_modules/
/usr/local/share/npm/bin
.npm

Related

Cannot install phonegap on MAC OS

I have tried to install phonegap with the following command.
sudo /usr/local/bin/npm install -g phonegap#latest
However I get this output. I cannot find any log, where is it? Or any help with the issue.
> ws#0.4.31 install /usr/local/lib/node_modules/phonegap/node_modules/connect-phonegap/node_modules/socket.io/node_modules/engine.io/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
> ws#0.4.31 install /usr/local/lib/node_modules/phonegap/node_modules/connect-phonegap/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
/usr/local/bin/phonegap -> /usr/local/lib/node_modules/phonegap/bin/phonegap.js
phonegap#5.3.9 /usr/local/lib/node_modules/phonegap
├── pluralize#0.0.4
├── colors#0.6.0-1
├── semver#1.1.0
├── minimist#0.1.0
├── qrcode-terminal#0.9.4
├── shelljs#0.1.4
├── prompt#0.2.11 (revalidator#0.1.8, pkginfo#0.3.1, read#1.0.7, winston#0.6.2, utile#0.2.1)
├── phonegap-build#0.9.2 (colors#0.6.2, qrcode-terminal#0.8.0, optimist#0.3.7, shelljs#0.0.9, phonegap-build-api#0.3.3)
├── connect-phonegap#0.18.1 (home-dir#0.1.2, connect-inject#0.3.2, ip#0.3.1, adm-zip#0.4.7, request-progress#0.3.1, http-proxy#1.8.1, walkdir#0.0.8, shelljs#0.2.6, useragent#2.0.8, request#2.33.0, node-static#0.7.0, gaze#0.4.3, tar#0.1.19, localtunnel#1.3.0, socket.io#1.0.4, archiver#0.14.3, connect#2.12.0)
└── cordova#5.4.1 (underscore#1.7.0, q#1.0.1, ansi#0.3.0, nopt#3.0.1, update-notifier#0.5.0, cordova-lib#5.4.1)
I am using node.js build 4.2.3 and using Mac OS
After i run the above command , I ran the command phonegap to ensure the install worked but i get the below output. Any ideas?
phonegap
-bash: phonegap: command not found
Check this out to install PhoneGap on Mac
And if you want to install node module globally, don't use sudo.
I FIXED the issue. Like stated in feedback the from Alexander O'Mara the installation was successful. My issue was phone gap was not firing.
The reason for this is the paths were not in etc/paths. so I did the following
In terminal (mac) ran this command
sudo vi /etc/paths
The file contented the following
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/mysql/bin
I added the below paths (press "i" to insert if you are new to terminal)
/usr/local/bin
/usr/local/sbin
The file now looked like this
/usr/local/bin
/usr/local/sbin
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/mysql/bin
Close the file (esc key then type "ZZ")
Then restart terminal. All will work fine ... or id did form me.

Strange npm behavior when installing packages like grunt

I run the following command in my bash and I get the related results:
merianos#merianos-desktop:~$ sudo npm install -g grunt-cli
/usr/local/bin/grunt -> /usr/local/lib/node_modules/grunt-cli/bin/grunt
grunt-cli#0.1.13 /usr/local/lib/node_modules/grunt-cli
├── resolve#0.3.1
├── nopt#1.0.10 (abbrev#1.0.7)
└── findup-sync#0.1.3 (lodash#2.4.2, glob#3.2.11)
and
merianos#merianos-desktop:~$ grunt
/usr/bin/env: node: No such file or directory
I also have try to install bower and gulp but again, when I try to execute them, I get a message related to the grunt above.
Can someone please help me ?
Just to know, I just installed Ubuntu 15.04. I don't know if that helps :)
Ubuntu package nodejs provide a binary as a /usr/bin/nodejs, not a /usr/bin/node, so most of cli tools can't find it. To solve the problem you need to make a symlink:
sudo ln -sT /usr/bin/nodejs /usr/bin/node

Cannot use installed packages with npm

Edit: Adding ~/npm/bin to path with PATH=$PATH:~/npm/bin helped, thank you Joachim Isaksson
EDIT:
Seems like i cannot install any packages with npm. After sucessfully installing them, i cannot use them with the assigned commands in the package. "No command '' found".
node -v
v0.11.14
npm -v
2.0.0
At ubuntu machine
It seems like i cannot install the resume-cli module, found here with using npm. Even though it installs without errors, it does not understand the basic commands after installing. Could it be a problem with the warning, showed under?
sudo npm install -g resume-cli
i get
npm WARN engine html-to-text#0.0.8: wanted: {"node":"~0.8.0"} (current: {"node":"0.10.32","npm":"1.4.28"})
Then
/home/bjornasm/npm/bin/resume -> /home/bjornasm/npm/lib/node_modules/resume-cli/index.js
resume-cli#0.3.10 /home/bjornasm/npm/lib/node_modules/resume-cli
├── cli-spinner#0.1.5
├── char-spinner#1.0.1
├── commander#2.3.0
├── colors#0.6.2
├── open#0.0.5
├── chalk#0.4.0 (has-color#0.1.7, ansi-styles#1.0.0, strip-ansi#0.1.1)
├── async#0.9.0
├── read#1.0.5 (mute-stream#0.0.4)
├── terminal-menu#0.3.2 (inherits#2.0.1, charm#0.1.2, resumer#0.0.0)
├── superagent#0.18.2 (extend#1.2.1, qs#0.6.6, methods#1.0.1, cookiejar#2.0.1, component-emitter#1.1.2, reduce-component#1.0.1, mime#1.2.11, debug#1.0.4, readable-stream#1.0.27-1, form-data#0.1.3, formidable#1.0.14)
├── resume-to-text#0.0.15 (mustache#0.8.2, html-to-text#0.0.8)
├── resume-to-html#0.0.21 (gravatar#1.0.6, resume-to-markdown#0.0.14, marked#0.3.2, mustache#0.8.2, lodash#2.4.1)
├── jsonlint#1.6.2 (nomnom#1.8.0, JSV#4.0.2)
└── resume-schema#0.0.15 (z-schema#2.4.10)
Then when running the following
resume --help
i get
resume: command not found
Anyone familiar with this?
Below are the steps to install a given release from source
NOTE - this installs nodejs which gives you both node as well as npm, they come together per release.
to start fresh remove prior node.js and npm installs as well as these :
sudo mv ~/.npmrc ~/.npmrc_ignore
sudo mv ~/.npm ~/.npm_ignore
sudo mv ~/tmp ~/tmp_ignore
sudo mv ~/.npm-init.js ~/.npm-init.js_ignore
to install nodejs and npm as yourself NOT root do these commands (OSX/linux) :
export NODE_PARENT=${HOME}/bin_0_10_32
mkdir ${NODE_PARENT}
download source from : http://nodejs.org/download/
cd node-v0.xxxx
./configure --prefix=${NODE_PARENT}/nodejs
make -j8
make install # IMPORTANT this is NOT using sudo
# not wanted since installing into $USER owned $NODE_PARENT
which puts it into dir defined by above --prefix
export PATH=${NODE_PARENT}/nodejs/bin:$PATH
define environment variable NODE_PATH so node can find dir for modules otherwise
npm install xxx will put newly installed module into current dir :
export NODE_PATH=${NODE_PARENT}/nodejs/lib/node_modules
when you use syntax : npm install -g some_cool_module
the -g for global installs it into dir $NODE_PATH and not your $PWD
nodejs install gives you npm as well :
ls -la ${NODE_PARENT}/nodejs/bin
Subsequent modules you install using global flag -g will automagically put their ~binaries~ into above bin dir ... like browserify
Now put above three export xxx=yyy
commands into your ~/.bashrc or some such so your environment is setup

cordova/phonegap: command not found, elementaryOS Luna

I've ran into some problem with installing cordova and phonegap.
When i try to run sudo npm install -g cordova (same with phonegap). I got this result (for cordova)
/home/tomek/npm/bin/cordova -> /home/tomek/npm/lib/node_modules/cordova/bin/cordova
cordova#3.5.0-0.2.7 /home/tomek/npm/lib/node_modules/cordova
├── q#0.9.7
├── underscore#1.4.4
├── nopt#2.2.1 (abbrev#1.0.5)
└── cordova-lib#0.21.7 (osenv#0.0.3, properties-parser#0.2.3, bplist-parser#0.0.5, mime#1.2.11, semver#2.0.11, dep-graph#1.1.0, plist-with-patches#0.5.1, shelljs#0.1.4, xcode#0.6.6, npmconf#0.1.16, elementtree#0.1.5, glob#3.2.11, rc#0.3.0, tar#0.1.19, request#2.22.0, npm#1.3.4, cordova-js#3.6.2)
But when I later try to run cordova command it simply doesn't find this command.
What do I do wrong, and why it doesn't work?
You may have your nodes confused, try the following in terminal:
$ sudo ln -s /usr/bin/nodejs /usr/local/bin/node
This install guide may help you: http://software-issues.blogspot.co.uk/2014/04/v-behaviorurldefaultvmlo.html, with your distro being ubuntu based you should have no problem following this. (Beware I forgot to sudo the npm command in the guide, must get around to editing that).

Command not found when trying to run a nodeschool lesson

I'm not sure if this is purposeful but when running the...
npm install learnyounode -g
..command in terminal, the module is being created in my home directory. When I try to run the 'learnyounode' command from the directory that I run the npm install from I get the message 'command not found'. I've looked in the usr directory but the learnyounode directory is not in there.
After everything intalls I get the following output
/Users/username/npm/bin/learnyounode -> /Users/username/npm/lib/node_modules/learnyounode/learnyounode.js
learnyounode#0.4.1 /Users/username/npm/lib/node_modules/learnyounode
├── duplexer#0.1.1
├── through#2.3.4
├── boganipsum#0.1.0
├── hyperquest#0.1.8 (through#2.2.7)
├── concat-stream#1.2.1 (bops#0.0.6)
├── bl#0.6.0 (readable-stream#1.0.26)
├── through2-map#1.2.1 (through2#0.2.3, terminus#1.0.9)
└── workshopper#0.7.2 (map-async#0.1.1, tuple-stream#0.0.2, split#0.2.10, mkdirp#0.3.5, xtend#2.1.2, colors-tmpl#0.1.0, terminal-menu#0.2.0, optimist#0.6.1, msee#0.1.1)
ps. I have a fresh install of node in my usr folder. I am more concerned that this problem is going to happen when I want to install other packages via NPM in the future.
I installed without the -g flag and it installed globally.
Trying to install learnyounode,
This path returns:
/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin

Resources