我开始学习离子框架,我的问题是我无法在ubuntu中安装 ionic-framework 。我的 Node.js 版本为v0.12.7
, npm 版本为2.11.3
。我按照http://ionicframework.com/docs/guide/installation.html链接,我收到以下错误::
安装 cordova
root@meutex-pc:~# npm install -g cordova
npm WARN engine xmlbuilder@2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"0.12.7","npm":"2.11.3"})
/home/meutex/npm/bin/cordova ->/home/meutex/npm/lib/node_modules/cordova/bin/cordova
cordova@5.2.0 /home/meutex/npm/lib/node_modules/cordova
├── underscore@1.7.0
├── q@1.0.1
├── nopt@3.0.1 (abbrev@1.0.7)
└── cordova-lib@5.2.0 (valid-identifier@0.0.1, osenv@0.1.0,properties-parser@0.2.3, bplist-parser@0.0.6, unorm@1.3.3, shelljs@0.3.0, semver@4.3.6, dep-graph@1.1.0, rc@0.5.2, elementtree@0.1.6, glob@4.0.6, cordova-registry-mapper@1.1.10, cordova-serve@0.1.2, aliasify@1.7.2, xcode@0.8.0, npmconf@2.1.2, plist@1.1.0, request@2.47.0, cordova-app-hello-world@3.9.0, init-package-json@1.8.0, tar@1.0.2, npm@2.14.0, cordova-js@4.1.0)
安装离子
root@meutex-pc:~# npm install -g ionic
npm WARN engine cordova-js@4.0.0: wanted: {"node":"~0.10.x"} (current: {"node":"0.12.7","npm":"2.11.3"})
npm WARN engine npm@1.3.4: wanted: {"node":">=0.6","npm":"1"} (current: {"node":"0.12.7","npm":"2.11.3"})
npm WARN engine xmlbuilder@2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"0.12.7","npm":"2.11.3"})
npm WARN installMany normalize-package-data was bundled with npm@1.3.4, but bundled package wasn't found in unpacked tree
...................................................................
...................................................................
...................................................................
现在创建第一个离子应用程序:
root@meutex-pc:~# ionic start test blank
TypeError: Invalid Version: Not installed
at new SemVer (/home/meutex/npm/lib/node_modules/ionic/node_modules/semver/semver.js:295:11)
at Range.test (/home/meutex/npm/lib/node_modules/ionic/node_modules/semver/semver.js:1049:15)
at Function.satisfies (/home/meutex/npm/lib/node_modules/ionic/node_modules/semver/semver.js:1098:16)
at Object.checkRuntime (/home/meutex/npm/lib/node_modules/ionic/node_modules/ionic-app-lib/lib/info.js:295:32)
at Object.run (/home/meutex/npm/lib/node_modules/ionic/lib/cli.js:54:10)
at Object.<anonymous> (/home/meutex/npm/lib/node_modules/ionic/bin/ionic:9:10)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
Invalid Version: Not installed (CLI v1.6.4)
Your system information:
Cordova CLI: Not installed
Gulp version: CLI version 3.9.0
Gulp local:
Ionic CLI Version: 1.6.4
Ionic App Lib Version: 0.3.8
OS: Distributor ID: Ubuntu Description: Ubuntu 14.04.3 LTS
Node Version: v0.12.7
修改:我还卸载了 node.js v0.12.7 ,然后安装 node.js v0.10.x ,但问题仍然存在它需要 node.js v0.12.x
答案 0 :(得分:0)
问题出在您的npm版本中。 请尝试“npm install npm @ latest” 这应该安装最新的npm。
完成后,尝试“npm install -g cordova”。 希望我不迟到
答案 1 :(得分:0)
1.Install nodejs by following command
sudo apt-get install nodejs
2.Check version for nodejs
node -v
2.Install npm
sudo apt-get install npm
3.Check version for npm and nvm
npm --version
nvm -- version
4.Install cordova and ionic
npm install -g cordova ionic
5.Check ionic information
ionic info
答案 2 :(得分:-1)
转到github克隆指向您目录的链接: [https://github.com/nraboy/ubuntu-ionic-installer]
git clone https://github.com/nraboy/ubuntu-ionic-installer
克隆后,转到目录 - ubuntu-ionic-installer:
cd ubuntu-ionic-installer
sudo ./ubuntu-ionic-installer
然后喝咖啡放松直到安装完成 你可以
只检查类型
ionic
在终端