ionic 4 - Uncaught TypeError when add plugin

拟墨画扇 提交于 2019-12-10 14:53:44

问题


I have created an ionic project(version: 4.0.6). I am getting below error after adding the plugin cordova-plugin-x-socialsharing from https://beta.ionicframework.com/docs/native/social-sharing. I am stuck here. Could anybody help me on this please.

index.js:413 Uncaught TypeError: Object(...) is not a function
    at index.js:413
    at Object../node_modules/@ionic-native/social-sharing/index.js (index.js:590)
    at __webpack_require__ (bootstrap:81)
    at Object../src/app/app.module.ts (app.global.ts:10)
    at __webpack_require__ (bootstrap:81)
    at Object../src/main.ts (environment.ts:15)
    at __webpack_require__ (bootstrap:81)
    at Object.0 (main.ts:12)
    at __webpack_require__ (bootstrap:81)
    at checkDeferredModules (bootstrap:43)

Update: I found one solution today! step1: change version of plugin in package.json to the same version of @ionic-native/core that shown in the package.json. Step 2: remove node_module and run npm install. Step 3: add '/ngx' at the end when import it like below; import { SocialSharing } from '@ionic-native/social-sharing/ngx'; step 4: do rest same as ionic 2 or 3


回答1:


The Angular versions are now imported from @ionic-native/plugin-xxx/ngx.



来源:https://stackoverflow.com/questions/51856853/ionic-4-uncaught-typeerror-when-add-plugin

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!