UnhandledPromiseRejectionWarning:错误:平台" 0"似乎没有添加到此项目中

时间:2018-04-15 07:15:59

标签: android node.js cordova ionic-framework

我创建了一个离子项目,如离子文档说

  1. $ ionic start HelloWorld blank
  2. $ cd HelloWorld
  3. $ ionic serve
  4. 安装相机插件

    • npm install @ ionic-native / camera --save
    • 离子cordova插件添加cordova-plugin-camera
    • 将插件添加到您应用的模块

      从@ ion-native / camera&#39 ;;中导入{相机} @NgModule({   提供者:[     相机   ] }) 导出类AppModule {}

  5. 当使用命令离子Cordova在设备上运行项目时运行android --device 0 我收到了这个错误

      

    cordova运行android 0 - 设备   检测到Android Studio项目

    (node:17224) UnhandledPromiseRejectionWarning: Error: The platform "0" does not appear to have been added to this project.
        at Object.getPlatformApi (C:\Users\m.besher\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\platforms\platforms.js:46:15)
        at C:\Users\m.besher\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\prepare.js:54:38
        at Array.map (<anonymous>)
        at C:\Users\m.besher\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\prepare.js:52:47
        at _fulfilled (C:\Users\m.besher\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:787:54)
        at self.promiseDispatch.done (C:\Users\m.besher\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:816:30)
        at Promise.promise.promiseDispatch (C:\Users\m.besher\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:749:13)
        at C:\Users\m.besher\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:557:44
        at flush (C:\Users\m.besher\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:108:17)
        at _combinedTickCallback (internal/process/next_tick.js:131:7)
    (node:17224) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of
    an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
    (node:17224) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that
    are not handled will terminate the Node.js process with a non-zero exit code.
    
    [OK] Your app has been deployed.
         Did you know you can live-reload changes from your app with --livereload?
    

0 个答案:

没有答案