Attempted import error: 'registerPlugin' is not exported from '@capacitor/core'. #4581
Unanswered
RYDodamani
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Can you show your |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to implement Bluetooth, with ionic and react taking help of this source https://github.com/capacitor-community/bluetooth-le .
I have this code in my app.tsx and also a button with onclick event that calls the below method,
`import { BleClient, numberToUUID, ScanMode } from '@capacitor-community/bluetooth-le';
const HEART_RATE_SERVICE = numberToUUID(0x180d);
async function scan(): Promise {
try {
await BleClient.initialize();
} catch (error) {
console.error(error);
}
}`
when I the project with ionic serve cmd, I get the following error message
./node_modules/@capacitor-community/bluetooth-le/dist/esm/plugin.js
Attempted import error: 'registerPlugin' is not exported from '@capacitor/core'.
Please help me with this, don't ignore, please elaborate your answer.
Info. I have installed capacitor 3
edits:
package.json file
{
"name": "dummy-app",
"version": "0.0.1",
"private": true,
"dependencies": {
"@capacitor-community/bluetooth-le": "^1.0.0-4",
"@capacitor/core": "2.4.7",
"@ionic/react": "^5.5.0",
"@ionic/react-router": "^5.5.0",
"@testing-library/jest-dom": "^5.11.9",
"@testing-library/react": "^11.2.5",
"@testing-library/user-event": "^12.6.3",
"@types/jest": "^26.0.20",
"@types/node": "^12.19.15",
"@types/react": "^16.14.3",
"@types/react-dom": "^16.9.10",
"@types/react-router": "^5.1.11",
"@types/react-router-dom": "^5.1.7",
"ionicons": "^5.4.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.2",
"typescript": "^4.1.3",
"web-vitals": "^0.2.4",
"workbox-background-sync": "^5.1.4",
"workbox-broadcast-update": "^5.1.4",
"workbox-cacheable-response": "^5.1.4",
"workbox-core": "^5.1.4",
"workbox-expiration": "^5.1.4",
"workbox-google-analytics": "^5.1.4",
"workbox-navigation-preload": "^5.1.4",
"workbox-precaching": "^5.1.4",
"workbox-range-requests": "^5.1.4",
"workbox-routing": "^5.1.4",
"workbox-strategies": "^5.1.4",
"workbox-streams": "^5.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@capacitor/cli": "2.4.7"
},
"description": "An Ionic project"
}
this is the problem associated with package.json
{
"resource": "/C:/Users/hp/MyIonic/dummy-app/package.json",
"owner": "generated_diagnostic_collection_name#0",
"code": "768",
"severity": 4,
"message": "Problems loading reference 'https://json.schemastore.org/package': Unable to load schema from 'https://json.schemastore.org/package': Request vscode/content failed unexpectedly without providing any details.",
"startLineNumber": 1,
"startColumn": 1,
"endLineNumber": 1,
"endColumn": 2
}
I also had problem with tsconfig.json
tsconfig.json file
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"src"
]
}
Issue with tsconfig.json
{
"resource": "/c:/Users/hp/MyIonic/dummy-app/tsconfig.json",
"owner": "generated_diagnostic_collection_name#0",
"code": "768",
"severity": 4,
"message": "Problems loading reference 'https://json.schemastore.org/tsconfig': Unable to load schema from 'https://json.schemastore.org/tsconfig': Request vscode/content failed unexpectedly without providing any details.",
"startLineNumber": 1,
"startColumn": 1,
"endLineNumber": 1,
"endColumn": 2
}
Beta Was this translation helpful? Give feedback.
All reactions