Ionic:添加平台会出错

时间:2016-01-07 14:27:25

标签: android cordova ionic-framework ionic osx-yosemite

首次与Ionic相遇,我正在为OSX Yosemite上的Android应用设置环境。通过运行命令sudo ionic platform android,我收到以下错误:

Error: %s Error: ENOENT, no such file or directory '/Users/myUser/hooks'
    at Error (native)
    at Object.fs.readdirSync (fs.js:761:18)
    at Object.setHooksPermission (/usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/lib/hooks.js:116:24)
    at Object.IonicTask.run (/usr/local/lib/node_modules/ionic/lib/ionic/cordova.js:51:13)
    at Object.run (/usr/local/lib/node_modules/ionic/lib/cli.js:95:32)
    at Object.<anonymous> (/usr/local/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)
Updated the hooks directory to have execute permissions
Error happened { [Error: ENOENT, open '/Users/myUser/config.xml'] errno: -2, code: 'ENOENT', path: '/Users/myUser/config.xml' }
Error: ENOENT, open '/Users/myUser/config.xml'
    at Error (native)

升级后的版本

├── cordova@5.4.1 
└── ionic@1.7.12 

4 个答案:

答案 0 :(得分:2)

应该是这个,

$ ionic platform add android

此外,您最好不要使用sudo运行命令,否则您可能会在一段时间后遇到许可问题。

答案 1 :(得分:1)

请转到myApp文件夹

然后运行命令:

离子平台添加android

答案 2 :(得分:0)

我的android平台损坏了,删除它并正确添加后,问题就解决了

答案 3 :(得分:0)

转到存在config.xml文件的ionic app文件夹,然后执行此命令。

$ cd Myapp 文件夹结构应该如下所示

$Myapp -> ls

$Myapp -> bower.json gulpfile.js ionic.project platforms README.md scss config.xml hooks package.json plugins resources www

$Myapp -> ionic platform add android