如何修复 Ionic 在科尔多瓦 5.0.0 中无法工作
Posted
技术标签:
【中文标题】如何修复 Ionic 在科尔多瓦 5.0.0 中无法工作【英文标题】:How to fixes Ionic no working in cordova 5.0.0 【发布时间】:2015-07-07 07:22:56 【问题描述】:cordova 更新到 5.0.0 插件新版本在我运行“hello ionic start blank”或 sidemenu 时重命名,我有问题,这就是终端,我有 mac OS X Yosemite
mac os 版本优胜美地
基于 sidemenu 项目在文件夹 /home/miguel/Cordova/hello 中创建 Ionic 应用程序
Downloading: https://github.com/driftyco/ionic-app-base/archive/master.zip
[=============================] 100% 0.0s
Downloading: https://github.com/driftyco/ionic-starter-sidemenu/archive/master.zip
[=============================] 100% 0.0s
Update config.xml
Initializing cordova project
running cordova plugin add org.apache.cordova.device
WARNING: org.apache.cordova.device has been renamed to cordova-plugin-device. You may not be getting the latest version! We suggest you cordova plugin rm org.apache.cordova.device and cordova plugin add cordova-plugin-device.
Fetching plugin "org.apache.cordova.device" via cordova plugins registry
Fetching from cordova plugins registry failed: EACCES, mkdir '/home/miguel/tmp/npm-3493-DFp6DkqV'
Fetching plugin "org.apache.cordova.device" via npm
npm http GET https://registry.npmjs.org/org.apache.cordova.device2
npm http 404 https://registry.npmjs.org/org.apache.cordova.device2
Fetching from npm failed: 404 Not Found: org.apache.cordova.device
Error: 404 Not Found: org.apache.cordova.device
at RegClient. (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:268:14)
at Request.self.callback (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/request/index.js:148:22)
at Request.EventEmitter.emit (events.js:98:17)
at Request. (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/request/index.js:876:14)
at Request.EventEmitter.emit (events.js:117:20)
at IncomingMessage. (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/request/index.js:827:12)
at IncomingMessage.EventEmitter.emit (events.js:117:20)
at streamreadable.js:920:16
at process._tickCallback (node.js:415:13)
running cordova plugin add org.apache.cordova.console
WARNING: org.apache.cordova.console has been renamed to cordova-plugin-console. You may not be getting the latest version! We suggest you cordova plugin rm org.apache.cordova.console and cordova plugin add cordova-plugin-console.
Fetching plugin "org.apache.cordova.console" via cordova plugins registry
Fetching from cordova plugins registry failed: EACCES, mkdir '/home/miguel/tmp/npm-3506-WhGg6OTV'
Fetching plugin "org.apache.cordova.console" via npm
npm http GET https://registry.npmjs.org/org.apache.cordova.console1
npm http 404 https://registry.npmjs.org/org.apache.cordova.console1
Fetching from npm failed: 404 Not Found: org.apache.cordova.console
Error: 404 Not Found: org.apache.cordova.console
at RegClient. (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:268:14)
at Request.self.callback (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/request/index.js:148:22)
at Request.EventEmitter.emit (events.js:98:17)
at Request. (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/request/index.js:876:14)
at Request.EventEmitter.emit (events.js:117:20)
at IncomingMessage. (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/request/index.js:827:12)
at IncomingMessage.EventEmitter.emit (events.js:117:20)
at streamreadable.js:920:16
at process._tickCallback (node.js:415:13)
running cordova plugin add com.ionic.keyboard
Fetching plugin "com.ionic.keyboard" via cordova plugins registry
Fetching from cordova plugins registry failed: EACCES, mkdir '/home/miguel/tmp/npm-3519-Pc7mh_MZ'
Fetching plugin "com.ionic.keyboard" via npm
npm http GET https://registry.npmjs.org/com.ionic.keyboard
npm http 404 https://registry.npmjs.org/com.ionic.keyboard
TypeError: Cannot read property 'latest' of undefined
at next (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/lib/cache.js:687:35)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/lib/cache.js:675:5
at saved (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:142:7)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:133:7
at Object.oncomplete (fs.js:107:15)
【问题讨论】:
【参考方案1】:试试这个,
进入你的项目文件夹 hello 并使用以下命令直接从他们的 GitHub 安装 cordova 插件
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
更多详情请查看here上的问题
希望这会对你有所帮助。
【讨论】:
【参考方案2】:看看这个http://forum.ionicframework.com/t/new-cordova-5/21558/5
"警告:org.apache.cordova.device 已重命名为cordova-plugin-device。您可能没有获得最新版本!我们建议您使用cordova plugin rm org.apache.cordova.device 和cordova plugin add cordova -插件设备。 警告:org.apache.cordova.console 已重命名为 cordova-plugin-console。您可能没有获得最新版本!我们建议您使用 cordova plugin rm org.apache.cordova.console 和 cordova plugin add cordova-plugin-console。”
和
离子插件添加cordova-plugin-whitelist
【讨论】:
以上是关于如何修复 Ionic 在科尔多瓦 5.0.0 中无法工作的主要内容,如果未能解决你的问题,请参考以下文章
如何更改 Ionic 2 iOS 应用程序的位置访问描述?我正在为我的应用程序使用科尔多瓦地理定位插件