5
respostas

Não instala o plugin Date Picker e Vibration

Estou utilizando a versão do ionic solicitada no curso, 3.16 Ao tentar instalar o plugin, acusa dependencias:

C:\Alura\aluracar>npm install --save @ionic-native/date-picker aluracar@0.0.1 C:\Alura\aluracar +-- UNMET PEER DEPENDENCY @ionic-native/core@4.20.0 +-- @ionic-native/date-picker@5.15.1 `-- UNMET PEER DEPENDENCY rxjs@5.4.3

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\watchpack\node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN @ionic-native/core@4.20.0 requires a peer of rxjs@^5.5.11 but none was installed. npm WARN @ionic-native/date-picker@5.15.1 requires a peer of rxjs@^5.5.0 || ^6.5.0 but none was installed. npm WARN @ionic-native/date-picker@5.15.1 requires a peer of @ionic-native/core@^5.1.0 but none was installed. npm WARN @ionic-native/vibration@3.14.0 requires a peer of @ionic-native/core@^3.6.0 but none was installed.

5 respostas

Boa tarde, Cristiano! Como vai?

Vc poderia colar aqui o conteúdo completo do arquivo package.json do seu projeto? Quando for postar o código, utilize o botão "inserir código" e cole o conteúdo no lugar indicado.

Qualquer coisa é só falar!

Grande abraço e bons estudos, meu aluno!

Segue conteúdo do arquivo package.json

{
    "name": "aluracar",
    "version": "0.0.1",
    "author": "Ionic Framework",
    "homepage": "http://ionicframework.com/",
    "private": true,
    "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "lint": "ionic-app-scripts lint",
        "ionic:build": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve"
    },
    "dependencies": {
        "@angular/common": "4.4.4",
        "@angular/compiler": "4.4.4",
        "@angular/compiler-cli": "4.4.4",
        "@angular/core": "4.4.4",
        "@angular/forms": "4.4.4",
        "@angular/http": "4.4.4",
        "@angular/platform-browser": "4.4.4",
        "@angular/platform-browser-dynamic": "4.4.4",
        "@ionic-native/core": "^4.2.0",
        "@ionic-native/date-picker": "^5.15.1",
        "@ionic-native/splash-screen": "4.3.2",
        "@ionic-native/status-bar": "4.3.2",
        "@ionic-native/vibration": "^3.14.0",
        "@ionic/storage": "2.0.1",
        "cordova-android": "^6.2.3",
        "cordova-plugin-datepicker": "^0.9.3",
        "cordova-plugin-device": "^1.1.4",
        "cordova-plugin-ionic-webview": "^1.1.11",
        "cordova-plugin-splashscreen": "^4.0.3",
        "cordova-plugin-vibration": "^2.1.6",
        "cordova-plugin-whitelist": "^1.3.1",
        "ionic-angular": "3.8.0",
        "ionic-plugin-keyboard": "^2.2.1",
        "ionicons": "3.0.0",
        "rxjs": "^5.4.3",
        "sw-toolbox": "3.6.0",
        "zone.js": "0.8.18"
    },
    "devDependencies": {
        "@ionic/app-scripts": "3.0.1",
        "typescript": "2.3.4"
    },
    "description": "An Ionic project",
    "cordova": {
        "plugins": {
            "cordova-plugin-vibration": {},
            "cordova-plugin-datepicker": {},
            "cordova-plugin-device": {},
            "cordova-plugin-ionic-webview": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-whitelist": {},
            "ionic-plugin-keyboard": {}
        },
        "platforms": [
            "android"
        ]
    }
}

Opa, Cristiano! Experimente remover a pasta node_modules e, no terminal dentro da pasta do projeto, execute o comando npm install. Daí veja se as coisas funcionam da forma como esperava!

Qualquer coisa é só falar!

Grande abraço e bons estudos, meu aluno!

Bom dia Gabriel! Deu certo em partes..rs Removi a pasta e executei o npm install. O Vibration funcionou corretamente agora. Mas o DatePicker, no módulo principal (app.module.ts), ao colocar o DatePicker no providers, fica com seguinte erro: Type 'DatePickerOriginal' is not assignable to type 'Provider'. Type 'DatePickerOriginal' is missing the following properties from type 'FactoryProvider': provide, useFactoryts(2322)

Coloquei o import: import { DatePicker } from '@ionic-native/date-picker';

Mas parece que não reconhece que precisa pegar do ionic-native/date-picker. Quer o DatePickerOriginal

Fiz mais alguns testes. Removi o plugin cordova-plugin-datepicker Segui as orientações da documentação https://ionicframework.com/docs/native/date-picker Instalando o plugin sem colocar a versão. Na documentação pede para importar o DatePicker do '@ionic-native/date-picker/ngx' Fiz isso, não deu erro no código, mas na execução, quando clica no campo Data, dava o erro "Object is not function" Deixei o import sem o ngx('@ionic-native/date-picker'), não deu erro mais e funcionou ao clicar no campo Data.

Ufa!! Obrigado Gabriel.