Ionic framework——“Ionic”不被视为内部或外部命令

时间:2022-03-27 19:01:39

I was trying to install ionic and create a sample project on it since morning. But, was facing a series of issues since then. Tried solving them one by one. Atlast restarted my machine and opened command prompt to build the sample project and tried

我试着安装ionic,并从早上开始创建一个示例项目。但是,从那时起,他就面临着一系列的问题。试着逐一解决。最后重新启动机器并打开命令提示符来构建示例项目并尝试

path of the sample project> ionic build android

But, i kept on facing the error that states 'ionic' is not recognized as an internal or external command.

但是,我一直面临着一个错误,即‘ionic’不能被识别为内部或外部命令。

I tried clearing the cache and reinstalling ionic in my machine. Still, I face the same issue of ionic is not recognized as an internal or external command.

我试着清理缓存并在我的机器上重新安装离子。尽管如此,我仍然面临着同样的问题:离子不被认为是一种内部或外部命令。

Can somebody help me out on this issue?

有人能在这个问题上帮助我吗?

Thanks Manikandan J

由于Manikandan J

25 个解决方案

#1


30  

Somehow , my npm path was not there in PATH environmental Variable

不知何故,npm路径不在路径环境变量中

So after adding C:\Users\XXXXX\AppData\Roaming\npm to my PATH variable my problem solved :-)

所以添加C:\Users\XXXXX\AppData\Roaming\npm之后我的路径变量问题解决了:-)

#2


8  

Try to install the ionic framework with the -g parameter, so the installation will be globall, like this:

尝试安装带有-g参数的ionic框架,这样安装将是globall,如下所示:

npm install -g ionic

-g parameter mean "its binaries end up in your PATH environment variable."

-g参数表示“它的二进制数最终在路径环境变量中结束”。

#3


6  

If you're on Windows 10 (and possibly Vista/8/8.1) you need to run cmd.exe as an administrator. Now when you run the commands below, your environment settings will be made.

如果你使用的是Windows 10(可能还有Vista/8/8.1),你需要运行cmd。exe作为管理员。现在,当您运行下面的命令时,您的环境将被设置。

npm install -g cordova ionic

安装-g cordova

#4


4  

Check if the configuration is broken or not. the update might have installed it in the wrong place.

检查配置是否损坏。更新可能安装在错误的位置。

First check: npm config get prefix

首先检查:npm配置get前缀

In my case It wasn't set to /usr/local but in /usr/Roaming.

在我的例子中,它不是设置为/usr/local,而是在/usr/ roaming中。

So to fix it, use: npm config set prefix

要修复它,使用:npm配置设置前缀

Problem solved! :)

问题解决了!:)

#5


2  

setting the path variable to C:\Users\«user name folder»\appdata\Roaming\npm helped me to resolve the issue. Please try

设置path变量C:\Users\«用户名文件夹»\ appdata \漫游\ npm帮助我解决问题。请尝试

#6


2  

I ran this command to uninstall:

我运行这个命令卸载:

npm uninstall -g ionic cordova

and then ran the install:

然后运行安装:

npm install -g ionic cordova

and then everything started working again.

然后一切又开始运转。

#7


2  

Insert this into your system path. This happens because node modules are not seen but when you do this you make the path to the module. They are found in this location

将它插入到系统路径中。这是因为没有看到节点模块,但是当您这样做时,您将创建到模块的路径。他们是在这个地方找到的。

C:\Users\[username]\AppData\Roaming\npm

#8


2  

Below simple steps to follow to get it working:

以下简单的步骤可以让它工作:

  1. install Node.js
  2. 安装node . js
  3. Install Ionic and cordova : npm install -g cordova ionic
  4. 安装Ionic和cordova: npm安装-g cordova Ionic
  5. create a simple project: ionic start mySimpleApp tabs
  6. 创建一个简单的项目:ionic mystart simpleapp选项卡
  7. cd mySimpleApp
  8. cd mySimpleApp
  9. ionic cordova platform add android
  10. ionic cordova平台添加android
  11. Build the project: ionic build android
  12. 构建项目:ionic构建android。

#9


1  

This issue occurs when we change the path variables manually.Because of this change system doesn't find libraries for the command which needed to be executed.

当我们手动更改路径变量时,就会出现这个问题。因为这个变更系统没有找到需要执行的命令库。

While installing ionic cordova, ionic cli takes cares by adding path variable in your environment.Hope this content helps

在安装ionic cordova时,ionic cli通过在您的环境中添加路径变量来进行处理。希望这些内容可以帮助

path - C:\user\system_name\AppData\Roaming\npm

用户路径- C:\ \ system_name \ AppData \ \ npm徘徊

#10


1  

I had the same problem on Windows, and I find solution by navigating the command prompt to

我在Windows上遇到了同样的问题,我通过导航命令提示符找到了解决方案

C:\Users\[username]\AppData\Roaming\npm>

C:\Users\【用户名】\ AppData \漫游\ npm >

Cordova, Ionic, etc. are found here.

Cordova、Ionic等都在这里。

#11


0  

The process is simple

这个过程很简单

  1. Make sure that you have nodejs installed. Install NodeJs
  2. 确保您已经安装了nodejs。安装NodeJs
  3. Install ionic npm install -g ionic
  4. 安装ionic npm安装-g ionic
  5. Create a project ionic start sample.

    创建一个项目ionic start示例。

    You can define a sample project to create (ex: tabs) ionic start sample tabs. To see all the templates, just run ionic templates

    您可以定义一个示例项目来创建(ex: tabs) ionic start样例选项卡。要查看所有模板,只需运行ionic模板

  6. Add the platform you need (Android or iOS) ionic platform add android

    添加您需要的平台(Android或iOS) ionic平台添加Android

    Remember, add iOS platform, you need a Mac with xcode installed

    记住,添加iOS平台,你需要安装xcode的Mac

  7. Compile your app ionic build android

    编译你的应用ionic build android

If you have problems while installing ionic, try to run the prompt with Admin Rights

如果在安装ionic时遇到问题,请尝试使用Admin权限运行提示符

#12


0  

'ionic/java/cordova etc..' is not recognized as an internal or external command

“离子/ java /科尔多瓦等。不被视为内部或外部命令

for ionic or cordova install it from node using npm install -g ionic/cordova command.

对于ionic或cordova,请使用npm安装-g ionic/cordova命令从节点安装。

This kind of messages comes whenever its PATH not set properly for other programs like java. System has to recognize your command available on your system or not. This can be identified only when you set your environment variable.

当它的路径没有为其他程序(如java)正确设置时,就会出现这种消息。系统必须识别您的命令是否在系统上可用。只有当您设置环境变量时,才可以识别这一点。

use this for setting your path

使用这个设置路径

SET PATH = %PATH%; your app path to bin

设置路径= %路径%;你的应用程序路径到bin

#13


0  

Just follow this video, you have to set your path correctly.

按照这个视频,你必须正确设置路径。

http://learn.ionicframework.com/videos/windows-android/

http://learn.ionicframework.com/videos/windows-android/

1: Download and Install Java then open your system environment variables, and add to or create a new user variable called PATH with the full path to the bin folder of the new Java SDK installation.

1:下载并安装Java,然后打开您的系统环境变量,并添加或创建一个名为PATH的新用户变量,并将其添加到新Java SDK安装的bin文件夹中。

2: Download Apache Ant then add the full path to the bin/ folder to the end of your PATH environment variable.

2:下载Apache Ant,然后将完整的路径添加到bin/文件夹,并将其添加到path环境变量的末尾。

3: Add Android to PATH :Open up your environment variables setting and add the full path to both the adt-bundle/sdk/platform-tools/ folder and the adt-bundle/sdk/tools/ folder to the end of your PATH variable:

3:将Android添加到PATH:打开您的环境变量设置,并将完整路径添加到您的PATH变量的末尾:

4.Install nodeJs and now you can do

4所示。安装nodeJs,现在可以了

 npm install -g cordova ionic

#14


0  

I started getting this same error in the Console2 command prompt. I checked the environment variables and reinstalled ionic and cordova but this did not fixed it.

我开始在Console2命令提示符中得到相同的错误。我检查了环境变量并重新安装了ionic和cordova,但这并没有改变它。

I then tried ionic in Node.js command prompt and it worked perfectly. So if you follow the other advice and it still doesn't work, try a different command prompt.

然后我在Node上尝试了离子。js命令提示符,运行良好。因此,如果您遵循了其他的建议,但它仍然不起作用,请尝试另一个命令提示符。

#15


0  

I think you should copy the bin file to the system variables and it should be fine, at least I try it on Win7 and it worked. I also got the same prob like this before. Right click Computer, choose Properties, Advanced system settings and edit environment variables.

我认为您应该将bin文件复制到系统变量中,应该没问题,至少我在Win7上尝试过,它是有效的。我以前也遇到过类似的问题。右键单击计算机,选择属性、高级系统设置和编辑环境变量。

#16


0  

For the benefit of searchers, the other answers didn't work for me.

为了搜索者的利益,其他的答案对我不起作用。

I deleted the 'Ionic' folder from:

我从:

C:\Users\..{me}..\AppData\Roaming\npm\node_modules

C:\Users\……} {我. . \ AppData \ \ npm \ node_modules徘徊

Then installed again with:

然后再安装:

npm install -g ionic cordova

That fixed it.

固定。

#17


0  

Try reinstalling the ionic

试着重新安装离子

npm install ionic -g

#18


0  

uninstall ionic npm package and then clear all npm cache in appdata and then install ionic

卸载ionic npm包,然后在appdata中清除所有的npm缓存,然后安装ionic。

npm install -g ionic 
ionic info
  • you must install ionic package has global so use -g.
  • 你必须安装的离子包有全局,所以使用-g。
  • ionic info command is used to check the ionic information
  • ionic info命令用于检查ionic信息。

#19


0  

Well, after trying several answers from many posts like this one and realizing that my environment variables were there too, I ran the

好吧,在尝试了很多类似文章的答案后,我意识到我的环境变量也在那里,我运行了这个

npm install -g cordova ionic

from the inside of nodejs folder in Program Files with windows prompt as administrator.

从nodejs文件夹的内部在程序文件与windows提示作为管理员。

Initially I was installing it in my dev folder in D:\ partition. Hope it helps someone.

最初,我在D:\分区的dev文件夹中安装它。希望它能帮助一些人。

#20


0  

Probably you doesn't have ionic installed in your device. First check in terminal/cmd, have you installed ionic or not? you can check it with following command:

可能你的设备里没有安装离子。首先检查终端/cmd,是否安装了ionic ?您可以通过以下命令进行检查:

ionic -v

离子- v

#21


0  

C:\Program Files\nodejs\bin try adding this to your user and environment variables, under environment variables, and then close the command prompt window and open. I got my problem resolved :)

C:\Program Files\nodejs\bin尝试添加用户和环境变量,根据环境变量,然后关闭命令提示符窗口打开。我的问题解决了:

#22


0  

npm install -g cordova ionic

and then

然后

ionic start myApp tabs

and then

然后

cd myApp
ionic serve

#23


0  

Firstly uninstall the ionic module from the project by using the following command.

首先使用以下命令从项目中卸载ionic模块。

npm uninstall -g ionic cordova

卸载-g ionic cordova

Then install ionic and cordova dependencies seperately as follows.

然后按照如下方式分别安装ionic和cordova依赖项。

npm install -g ionic

npm安装- g离子

npm install -g cordova

npm安装- g科尔多瓦

#24


0  

environment variables window I solve the problem on windows 10. the problem was that in environment variables(i attach a picture) don't contain a path to the ionic folder.

环境变量窗口我解决了windows 10上的问题。问题是在环境变量(我附上一张图片)中不包含到ionic文件夹的路径。

#25


-1  

download JDK and install https://cordova.apache.org/docs/en/latest/guide/platforms/android/#java-development-kit-jdk

下载JDK并安装https://cordova.apache.org/docs/en/latest/guide/platforms/android/#java-development-kit-jdk

1-Set the JAVA_HOME environment variable to the location of your JDK installation

1将JAVA_HOME环境变量设置为JDK安装的位置

2-Set the ANDROID_HOME environment variable to the location of your Android SDK installation

2 .将ANDROID_HOME环境变量设置为Android SDK安装位置

3-It is also recommended that you add the Android SDK's tools, tools/bin, and platform-tools directories to your PATH

Remember, add iOS platform, you need a Mac with xcode installed

记住,添加iOS平台,你需要安装xcode的Mac

visit this link flow step by step https://cordova.apache.org/docs/en/latest/guide/platforms/android/

一步步访问这个链接流https://cordova.apache.org/docs/en/latest/guide/platforms/android/

#1


30  

Somehow , my npm path was not there in PATH environmental Variable

不知何故,npm路径不在路径环境变量中

So after adding C:\Users\XXXXX\AppData\Roaming\npm to my PATH variable my problem solved :-)

所以添加C:\Users\XXXXX\AppData\Roaming\npm之后我的路径变量问题解决了:-)

#2


8  

Try to install the ionic framework with the -g parameter, so the installation will be globall, like this:

尝试安装带有-g参数的ionic框架,这样安装将是globall,如下所示:

npm install -g ionic

-g parameter mean "its binaries end up in your PATH environment variable."

-g参数表示“它的二进制数最终在路径环境变量中结束”。

#3


6  

If you're on Windows 10 (and possibly Vista/8/8.1) you need to run cmd.exe as an administrator. Now when you run the commands below, your environment settings will be made.

如果你使用的是Windows 10(可能还有Vista/8/8.1),你需要运行cmd。exe作为管理员。现在,当您运行下面的命令时,您的环境将被设置。

npm install -g cordova ionic

安装-g cordova

#4


4  

Check if the configuration is broken or not. the update might have installed it in the wrong place.

检查配置是否损坏。更新可能安装在错误的位置。

First check: npm config get prefix

首先检查:npm配置get前缀

In my case It wasn't set to /usr/local but in /usr/Roaming.

在我的例子中,它不是设置为/usr/local,而是在/usr/ roaming中。

So to fix it, use: npm config set prefix

要修复它,使用:npm配置设置前缀

Problem solved! :)

问题解决了!:)

#5


2  

setting the path variable to C:\Users\«user name folder»\appdata\Roaming\npm helped me to resolve the issue. Please try

设置path变量C:\Users\«用户名文件夹»\ appdata \漫游\ npm帮助我解决问题。请尝试

#6


2  

I ran this command to uninstall:

我运行这个命令卸载:

npm uninstall -g ionic cordova

and then ran the install:

然后运行安装:

npm install -g ionic cordova

and then everything started working again.

然后一切又开始运转。

#7


2  

Insert this into your system path. This happens because node modules are not seen but when you do this you make the path to the module. They are found in this location

将它插入到系统路径中。这是因为没有看到节点模块,但是当您这样做时,您将创建到模块的路径。他们是在这个地方找到的。

C:\Users\[username]\AppData\Roaming\npm

#8


2  

Below simple steps to follow to get it working:

以下简单的步骤可以让它工作:

  1. install Node.js
  2. 安装node . js
  3. Install Ionic and cordova : npm install -g cordova ionic
  4. 安装Ionic和cordova: npm安装-g cordova Ionic
  5. create a simple project: ionic start mySimpleApp tabs
  6. 创建一个简单的项目:ionic mystart simpleapp选项卡
  7. cd mySimpleApp
  8. cd mySimpleApp
  9. ionic cordova platform add android
  10. ionic cordova平台添加android
  11. Build the project: ionic build android
  12. 构建项目:ionic构建android。

#9


1  

This issue occurs when we change the path variables manually.Because of this change system doesn't find libraries for the command which needed to be executed.

当我们手动更改路径变量时,就会出现这个问题。因为这个变更系统没有找到需要执行的命令库。

While installing ionic cordova, ionic cli takes cares by adding path variable in your environment.Hope this content helps

在安装ionic cordova时,ionic cli通过在您的环境中添加路径变量来进行处理。希望这些内容可以帮助

path - C:\user\system_name\AppData\Roaming\npm

用户路径- C:\ \ system_name \ AppData \ \ npm徘徊

#10


1  

I had the same problem on Windows, and I find solution by navigating the command prompt to

我在Windows上遇到了同样的问题,我通过导航命令提示符找到了解决方案

C:\Users\[username]\AppData\Roaming\npm>

C:\Users\【用户名】\ AppData \漫游\ npm >

Cordova, Ionic, etc. are found here.

Cordova、Ionic等都在这里。

#11


0  

The process is simple

这个过程很简单

  1. Make sure that you have nodejs installed. Install NodeJs
  2. 确保您已经安装了nodejs。安装NodeJs
  3. Install ionic npm install -g ionic
  4. 安装ionic npm安装-g ionic
  5. Create a project ionic start sample.

    创建一个项目ionic start示例。

    You can define a sample project to create (ex: tabs) ionic start sample tabs. To see all the templates, just run ionic templates

    您可以定义一个示例项目来创建(ex: tabs) ionic start样例选项卡。要查看所有模板,只需运行ionic模板

  6. Add the platform you need (Android or iOS) ionic platform add android

    添加您需要的平台(Android或iOS) ionic平台添加Android

    Remember, add iOS platform, you need a Mac with xcode installed

    记住,添加iOS平台,你需要安装xcode的Mac

  7. Compile your app ionic build android

    编译你的应用ionic build android

If you have problems while installing ionic, try to run the prompt with Admin Rights

如果在安装ionic时遇到问题,请尝试使用Admin权限运行提示符

#12


0  

'ionic/java/cordova etc..' is not recognized as an internal or external command

“离子/ java /科尔多瓦等。不被视为内部或外部命令

for ionic or cordova install it from node using npm install -g ionic/cordova command.

对于ionic或cordova,请使用npm安装-g ionic/cordova命令从节点安装。

This kind of messages comes whenever its PATH not set properly for other programs like java. System has to recognize your command available on your system or not. This can be identified only when you set your environment variable.

当它的路径没有为其他程序(如java)正确设置时,就会出现这种消息。系统必须识别您的命令是否在系统上可用。只有当您设置环境变量时,才可以识别这一点。

use this for setting your path

使用这个设置路径

SET PATH = %PATH%; your app path to bin

设置路径= %路径%;你的应用程序路径到bin

#13


0  

Just follow this video, you have to set your path correctly.

按照这个视频,你必须正确设置路径。

http://learn.ionicframework.com/videos/windows-android/

http://learn.ionicframework.com/videos/windows-android/

1: Download and Install Java then open your system environment variables, and add to or create a new user variable called PATH with the full path to the bin folder of the new Java SDK installation.

1:下载并安装Java,然后打开您的系统环境变量,并添加或创建一个名为PATH的新用户变量,并将其添加到新Java SDK安装的bin文件夹中。

2: Download Apache Ant then add the full path to the bin/ folder to the end of your PATH environment variable.

2:下载Apache Ant,然后将完整的路径添加到bin/文件夹,并将其添加到path环境变量的末尾。

3: Add Android to PATH :Open up your environment variables setting and add the full path to both the adt-bundle/sdk/platform-tools/ folder and the adt-bundle/sdk/tools/ folder to the end of your PATH variable:

3:将Android添加到PATH:打开您的环境变量设置,并将完整路径添加到您的PATH变量的末尾:

4.Install nodeJs and now you can do

4所示。安装nodeJs,现在可以了

 npm install -g cordova ionic

#14


0  

I started getting this same error in the Console2 command prompt. I checked the environment variables and reinstalled ionic and cordova but this did not fixed it.

我开始在Console2命令提示符中得到相同的错误。我检查了环境变量并重新安装了ionic和cordova,但这并没有改变它。

I then tried ionic in Node.js command prompt and it worked perfectly. So if you follow the other advice and it still doesn't work, try a different command prompt.

然后我在Node上尝试了离子。js命令提示符,运行良好。因此,如果您遵循了其他的建议,但它仍然不起作用,请尝试另一个命令提示符。

#15


0  

I think you should copy the bin file to the system variables and it should be fine, at least I try it on Win7 and it worked. I also got the same prob like this before. Right click Computer, choose Properties, Advanced system settings and edit environment variables.

我认为您应该将bin文件复制到系统变量中,应该没问题,至少我在Win7上尝试过,它是有效的。我以前也遇到过类似的问题。右键单击计算机,选择属性、高级系统设置和编辑环境变量。

#16


0  

For the benefit of searchers, the other answers didn't work for me.

为了搜索者的利益,其他的答案对我不起作用。

I deleted the 'Ionic' folder from:

我从:

C:\Users\..{me}..\AppData\Roaming\npm\node_modules

C:\Users\……} {我. . \ AppData \ \ npm \ node_modules徘徊

Then installed again with:

然后再安装:

npm install -g ionic cordova

That fixed it.

固定。

#17


0  

Try reinstalling the ionic

试着重新安装离子

npm install ionic -g

#18


0  

uninstall ionic npm package and then clear all npm cache in appdata and then install ionic

卸载ionic npm包,然后在appdata中清除所有的npm缓存,然后安装ionic。

npm install -g ionic 
ionic info
  • you must install ionic package has global so use -g.
  • 你必须安装的离子包有全局,所以使用-g。
  • ionic info command is used to check the ionic information
  • ionic info命令用于检查ionic信息。

#19


0  

Well, after trying several answers from many posts like this one and realizing that my environment variables were there too, I ran the

好吧,在尝试了很多类似文章的答案后,我意识到我的环境变量也在那里,我运行了这个

npm install -g cordova ionic

from the inside of nodejs folder in Program Files with windows prompt as administrator.

从nodejs文件夹的内部在程序文件与windows提示作为管理员。

Initially I was installing it in my dev folder in D:\ partition. Hope it helps someone.

最初,我在D:\分区的dev文件夹中安装它。希望它能帮助一些人。

#20


0  

Probably you doesn't have ionic installed in your device. First check in terminal/cmd, have you installed ionic or not? you can check it with following command:

可能你的设备里没有安装离子。首先检查终端/cmd,是否安装了ionic ?您可以通过以下命令进行检查:

ionic -v

离子- v

#21


0  

C:\Program Files\nodejs\bin try adding this to your user and environment variables, under environment variables, and then close the command prompt window and open. I got my problem resolved :)

C:\Program Files\nodejs\bin尝试添加用户和环境变量,根据环境变量,然后关闭命令提示符窗口打开。我的问题解决了:

#22


0  

npm install -g cordova ionic

and then

然后

ionic start myApp tabs

and then

然后

cd myApp
ionic serve

#23


0  

Firstly uninstall the ionic module from the project by using the following command.

首先使用以下命令从项目中卸载ionic模块。

npm uninstall -g ionic cordova

卸载-g ionic cordova

Then install ionic and cordova dependencies seperately as follows.

然后按照如下方式分别安装ionic和cordova依赖项。

npm install -g ionic

npm安装- g离子

npm install -g cordova

npm安装- g科尔多瓦

#24


0  

environment variables window I solve the problem on windows 10. the problem was that in environment variables(i attach a picture) don't contain a path to the ionic folder.

环境变量窗口我解决了windows 10上的问题。问题是在环境变量(我附上一张图片)中不包含到ionic文件夹的路径。

#25


-1  

download JDK and install https://cordova.apache.org/docs/en/latest/guide/platforms/android/#java-development-kit-jdk

下载JDK并安装https://cordova.apache.org/docs/en/latest/guide/platforms/android/#java-development-kit-jdk

1-Set the JAVA_HOME environment variable to the location of your JDK installation

1将JAVA_HOME环境变量设置为JDK安装的位置

2-Set the ANDROID_HOME environment variable to the location of your Android SDK installation

2 .将ANDROID_HOME环境变量设置为Android SDK安装位置

3-It is also recommended that you add the Android SDK's tools, tools/bin, and platform-tools directories to your PATH

Remember, add iOS platform, you need a Mac with xcode installed

记住,添加iOS平台,你需要安装xcode的Mac

visit this link flow step by step https://cordova.apache.org/docs/en/latest/guide/platforms/android/

一步步访问这个链接流https://cordova.apache.org/docs/en/latest/guide/platforms/android/