'phonegap' is not recognized as an interna

2019-02-13 04:08发布

I am trying to install phonegap 3.1 version using node.js, Command line interface.

Phonegap got installed on the machine, but I am not able to use phonegap command. When I list packages, I can see phonegap, but can not run command to create project.

System config : OS : WIN XP, node version : 0.10.22, npm version : 1.3.14, phonegap version : 3.1.0,

EDIT :

Error Message

C:>phonegap

'phonegap' is not recognized as an internal or external command, operable program or batch file.

C:>npm -g list phonegap

C:\Documents and Settings\vishal.kardode\Application Data\npm └── phonegap@3.1.0-0.15.0

7条回答
Anthone
2楼-- · 2019-02-13 04:46

I got the same error and adding the path to the Environment Variables did the trick.

Just pay attention to the correct path, because in my case it is different from the question.

Look what you get when you do: npm -g list phonegap

In my case it displays: c:\usr\local

So this is the path you need to add to the PATH variable under User variables on the Environment Variables.

查看更多
倾城 Initia
3楼-- · 2019-02-13 04:49

Run CMD as Administrator seems to solve the problem.

查看更多
女痞
4楼-- · 2019-02-13 04:55

Delete path variable from "users variable". That worked nicely for me.

查看更多
等我变得足够好
5楼-- · 2019-02-13 04:56

change the name from phonegap to cordova You can use the following command to create a project through command line cordova create hello com.example.hello HelloWorld

查看更多
做个烂人
6楼-- · 2019-02-13 05:02

The Problem with enthronement variable for default path of your your current user. Follow the steps.

  1. Click the Start menu and type "regedit" on the search box. This will launch the Windows Registry Editor program.
  2. Enter to the following Registry entry: HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings
  3. Select the "Enabled" entry in the right side window. If this entry is there, right-click and select "New" followed by "DWORD Value." Name the value "Enabled."
  4. Right-click the "Enabled" entry and click "Modify."
  5. Change the number in the "Value" box to "1." This will re-enable WSH.
  6. close all opened cmd windows and open a new window.
查看更多
看我几分像从前
7楼-- · 2019-02-13 05:03

One reason may be you are running window command prompt instead of node.js command prompt. you can simply press window button and then search node.js,it will show you node.js command prompt, run it and then type phonegap command there to check whether the phone gap is properly installed or not.

if you see something like this

Usage: phonegap [options] [commands] Description: PhoneGap command-line tool. Commands: help [command] output usage information create create a phonegap project ...

that means phonegap has installed successfully.. you can now execute any phonegap command

查看更多
登录 后发表回答