无法更新Ionic-CLI [英] Cannot update Ionic-CLI
问题描述
我在更新到最新版本的Ionic时遇到问题.当我尝试运行命令ionic g provider Tabs
并得到g is not a valid task
响应时,我意识到了这个问题.
I'm having an issue updating to the latest version of Ionic. I became aware of the issue when I tried to run the command ionic g provider Tabs
and got g is not a valid task
in response.
我安装了三个版本的NodeJS,可以在NVM之间切换.我尝试从所有三个版本中删除Ionic和Cordova,更新NPM,然后仅在最新版本的Node中重新安装.仍然没有运气.
I have three versions of NodeJS installed, that I switch between with NVM. I tried removing Ionic and Cordova from all three, updating NPM, and re-installing in just the latest version of Node. Still no luck.
我的系统信息如下:
` Cordova CLI:您已选择退出遥测.要更改此设置,请运行:打开cordova遥测. 6.3.1
` Cordova CLI: You have been opted out of telemetry. To change this, run: cordova telemetry on. 6.3.1
Gulp版本:需要外部模块babel-register Gulp本地:CLI版本1.2.1 Ionic CLI版本:1.7.7 Ionic应用程式库版本:0.6.3 ios-deploy版本:未安装 ios-sim版本:5.0.3 操作系统:Mac OS X El Capitan 节点版本:v6.7.0 Xcode版本:Xcode 8.0 Build版本8A218a `
Gulp version: Requiring external module babel-register Gulp local: CLI version 1.2.1 Ionic CLI Version: 1.7.7 Ionic App Lib Version: 0.6.3 ios-deploy version: Not installed ios-sim version: 5.0.3 OS: Mac OS X El Capitan Node Version: v6.7.0 Xcode version: Xcode 8.0 Build version 8A218a `
我整天都在墙上撞头,所以任何帮助将不胜感激!
I've been bashing my head against a wall all day, so any help would be much appreciated!
推荐答案
根据文档,ionic g
仅自Ionic 2.0.0起可用.
According to the doc, ionic g
is only available since Ionic 2.0.0.
您的系统信息表明您拥有:Ionic CLI 1.7.7
And your system info says that you have : Ionic CLI 1.7.7
您必须更新Ionic.
You have to update Ionic.
npm install -g ionic@2.1.0
编辑
尝试在安装之前删除旧版本
Try before install to remove the old version
npm uninstall -g ionic
还要验证您是否没有在本地安装任何版本错误的离子软件包(请检查项目的node_modules文件夹).
Verify also that you don't have any ionic package installed locally with the wrong version (check folder node_modules of your project).
这篇关于无法更新Ionic-CLI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!