刚开始尝试离子框架,当我想添加android平台时,我遇到了一些麻烦。当我运行命令时:
ionic platform add android
我得到以下
Done adding default Ionic resources
Adding icons for platform: android
running cordova platform add android
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.ionicframework.tester166478
Name: tester
Activity: MainActivity
Android target: android-22
Copying template files...
Android project created with cordova-android@4.0.0
Running command: "/media/denny/New Volume/projects/mobile/tester/hooks/after_prepare/010_add_platform_class.js" "/media/denny/New Volume/projects/mobile/tester"
Installing "com.ionic.keyboard" for android
Failed to install 'com.ionic.keyboard':Error: /media/denny/New Volume/projects/mobile/tester/platforms/android/cordova/version: Command failed with exit code EACCES
at ChildProcess.whenDone (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.emit (events.js:95:17)
at Process.ChildProcess._handle.onexit (child_process.js:818:12)
Error: /media/denny/New Volume/projects/mobile/tester/platforms/android/cordova/version: Command failed with exit code EACCES
at ChildProcess.whenDone (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.emit (events.js:95:17)
at Process.ChildProcess._handle.onexit (child_process.js:818:12)
可能导致上述错误的原因是什么?
答案 0 :(得分:3)
根据错误消息,由于缺少权限,平台添加失败
Command failed with exit code EACCES
尝试创建文件夹/media/denny/New Volume/projects/mobile/tester/platforms/android/cordova/version
时。
如果您正在运行Mac,则应该看到用户 holmescn 的this回答。
如果您正在运行Linux,请尝试运行
chmod -r 777 *
在您的项目根目录上获取足够的权限。