首页 文章

已安装Ionic和Cordova但无法识别命令

提问于
浏览
1

我在全局安装了ionic和cordova但是无法识别命令 .

我在Win 7 - 64bit上
安装了最新的Nodejs

这是安装日志:

$ npm install -g cordova
npm WARN engine xmlbuilder@2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"4.1.1","npm":"2.14.4"})
C:\Program Files\Git\usr\local\cordova -> C:\Program Files\Git\usr\local\node_modules\cordova\bin\cordova
cordova@5.3.3 C:\Program Files\Git\usr\local\node_modules\cordova
├── underscore@1.7.0
├── q@1.0.1
├── nopt@3.0.1 (abbrev@1.0.7)
└── cordova-lib@5.3.3 (valid-identifier@0.0.1, unorm@1.3.3, osenv@0.1.0, properties-parser@0.2.3, bplist-parser@0.0.6, semver@4.3.6, shelljs@0.3.0, cordova-app-hello-world@3.9.0, dep-graph@1.1.0, rc@0.5.2, elementtree@0.1.6, xcode@0.8.0, glob@5.0.15, npmconf@2.1.2, tar@1.0.2, cordova-serve@0.1.3, request@2.47.0, aliasify@1.7.2, cordova-registry-mapper@1.1.12, init-package-json@1.9.1, plist@1.1.0, cordova-js@4.1.1, npm@2.14.7)


$ npm install -g ionic
npm WARN engine cordova-js@4.0.0: wanted: {"node":"~0.10.x"} (current: {"node":"4.1.1","npm":"2.14.4"})
npm WARN engine npm@1.3.4: wanted: {"node":">=0.6","npm":"1"} (current: {"node":"4.1.1","npm":"2.14.4"})
npm WARN engine xmlbuilder@2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"4.1.1","npm":"2.14.4"})
npm WARN installMany normalize-package-data was bundled with npm@1.3.4, but bundled package wasn't found in unpacked tree
C:\Program Files\Git\usr\local\ionic -> C:\Program Files\Git\usr\local\node_modules\ionic\bin\ionic
ionic@1.6.5 C:\Program Files\Git\usr\local\node_modules\ionic
├── connect-livereload@0.5.2
├── underscore@1.7.0
├── proxy-middleware@0.7.0
├── progress@1.1.7
├── open@0.0.5
├── colors@0.6.2
├── q@1.0.1
├── async@0.9.2
├── crc@3.2.1
├── ncp@0.4.2
├── semver@4.3.6
├── shelljs@0.2.6
├── cross-spawn@0.2.3 (lru-cache@2.7.0)
├── optimist@0.6.0 (wordwrap@0.0.3, minimist@0.0.10)
├── cli-table@0.3.1 (colors@1.0.3)
├── finalhandler@0.2.0 (escape-html@1.0.1, debug@2.0.0)
├── connect@3.1.1 (utils-merge@1.0.0, parseurl@1.3.0, finalhandler@0.1.0, debug@1.0.4)
├── form-data@0.1.4 (mime@1.2.11, combined-stream@0.0.7)
├── event-stream@3.0.20 (pause-stream@0.0.11, stream-combiner@0.0.4, from@0.1.3, duplexer@0.1.1, split@0.2.10, through@2.3.8, map-stream@0.0.6)
├── opbeat-ionic@1.1.3 (console-log-level@1.1.2, json-stringify-safe@5.0.1, stackman@0.2.3, after-all@2.0.2)
├── serve-static@1.7.1 (utils-merge@1.0.0, escape-html@1.0.1, parseurl@1.3.0, send@0.10.1)
├── tiny-lr-fork@0.0.5 (debug@0.7.4, qs@0.5.6, faye-websocket@0.4.4, noptify@0.0.3)
├── request@2.51.0 (forever-agent@0.5.2, aws-sign2@0.5.0, caseless@0.8.0, tunnel-agent@0.4.1, oauth-sign@0.5.0, stringstream@0.0.4, json-stringify-safe@5.0.1, mime-types@1.0.2, qs@2.3.3, node-uuid@1.4.3, tough-cookie@2.0.0, combined-stream@0.0.7, http-signature@0.10.1, form-data@0.2.0, bl@0.9.4, hawk@1.1.1)
├── vinyl-fs@0.3.7 (graceful-fs@3.0.8, lodash@2.4.2, strip-bom@1.0.0, vinyl@0.4.6, mkdirp@0.5.1, through2@0.6.5, glob-stream@3.1.18, glob-watcher@0.0.6)
├── unzip@0.1.9 (setimmediate@1.0.2, readable-stream@1.0.33, pullstream@0.4.1, match-stream@0.0.2, binary@0.3.0, fstream@0.1.31)
├── prompt@0.2.12 (revalidator@0.1.8, pkginfo@0.3.0, read@1.0.7, utile@0.2.1, winston@0.6.2)
├── gulp@3.8.8 (interpret@0.3.10, pretty-hrtime@0.2.2, deprecated@0.0.1, archy@0.0.2, minimist@1.2.0, semver@3.0.1, tildify@1.1.1, chalk@0.5.1, orchestrator@0.3.7, gulp-util@3.0.6, liftoff@0.12.1)
├── cheerio@0.19.0 (entities@1.1.1, dom-serializer@0.1.0, css-select@1.0.0, htmlparser2@3.8.3, lodash@3.10.1)
├── xml2js@0.4.4 (sax@0.6.1, xmlbuilder@3.1.0)
├── npm@2.1.3
└── ionic-app-lib@0.3.9 (vinyl-fs@1.0.0, archiver@0.5.2, ionic-cordova-lib@5.1.7)


$ cordova
bash: cordova: command not found


$ ionic
bash: ionic: command not found

这是我的系统环境Path中的变量列表:

C:\Users\\AppData\Roaming\npm;C:\Program Files\nodejs;
C:\Program Files\nodejs\node_modules\npm;
C:\Android;C:\Android\sdk;
C:\Android\sdk\platforms;
C:\Android\sdk\platform-tools;
C:\Android\sdk\tools;
C:\Android\sdk\platforms\android-19;
C:\Android\sdk\platforms;
C:\Android\sdk\platforms-tools;
C:\Program Files\Java\jdk1.8.0_60\bin;
C:\Android\sdk\tools;
C:\apache-ant-1.9.6\bin;
C:\Program Files\nodejs;
C:\Android\sdk\system-images;

到目前为止我做的修复没有运气:

  • 重新安装nodejs

  • npm缓存清理

  • 手动清除npm-cache文件夹并安装离子cordova

有什么东西我不见了吗?为什么我不能使用离子?

请告诉我们是否还需要其他信息:)

附:我在这里和同样的离题论坛上尝试了很多线程,但没有修复工作,这就是为什么我决定 Build 自己的线程!

提前致谢!

1 回答

  • 0

    如果你在Windows上,使用Git Bash shell并且遇到调用cordova和ionic的问题,也许你必须为c:\ users [你的用户名] .bash_profile 添加路径值这有助于将windows路径与git bash shell路径进行比较:Git Bash doesn't see my PATH对我来说,全局路径在那里,但用户路径没有 . 我不得不添加: PATH=$PATH: / c / Program Files(x86)/ Microsoft VS Code / bin: /C/Users/[my username]/AppData/Roaming/npm

相关问题