NathanaelA / nativescript-sqlite

SQLite Bindng for NativeScript
MIT License
160 stars 53 forks source link

DATABASE NOT CREATED SUCCESSFULLY ReferenceError: Can't find variable: sqlite3_open_v2 #61

Closed SandipFichadiya closed 7 years ago

SandipFichadiya commented 7 years ago

I have added sqlite plugin in my project. After getting this error "DATABASE NOT CREATED SUCCESSFULLY ReferenceError: Can't find variable: sqlite3_open_v2", I am not able to proceed further.

Here is my package.json file,

{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "com.myApp",
    "tns-ios": {
      "version": "3.2.0"
    }
  },
  "dependencies": {
    "@angular/common": "2.4.3",
    "@angular/compiler": "2.4.3",
    "@angular/core": "2.4.3",
    "@angular/forms": "2.4.3",
    "@angular/http": "2.4.3",
    "@angular/platform-browser": "2.4.3",
    "@angular/platform-browser-dynamic": "2.4.3",
    "@angular/router": "3.4.3",
    "moment": "^2.17.1",
    "nativescript-angular": "1.4.0",
    "nativescript-angular-snapshot": "1.4.0-5.5.372.32-1",
    "nativescript-appversion": "^1.4.1",
    "nativescript-bluetooth": "^1.1.5",
    "nativescript-checkbox": "^1.2.8",
    "nativescript-email": "^1.4.0",
    "nativescript-geolocation": "^3.0.0",
    "nativescript-intl": "^3.0.0",
    "nativescript-iqkeyboardmanager": "^1.0.1",
    "nativescript-loading-indicator": "^2.2.2",
    "nativescript-orientation": "^1.6.1",
    "nativescript-pager": "^2.3.0",
    "nativescript-permissions": "^1.2.3",
    "nativescript-radiobutton": "^0.1.0",
    "nativescript-sqlite": "^1.1.10",
    "nativescript-stringformat": "^2.3.4",
    "nativescript-theme-core": "~1.0.2",
    "nativescript-themes": "^1.1.0",
    "nativescript-timedatepicker": "^1.1.1",
    "ng2-translate": "^5.0.0",
    "reflect-metadata": "~0.1.8",
    "rxjs": "~5.0.1",
    "tns-core-modules": "2.5.1"
  },
  "devDependencies": {
    "@angular/compiler-cli": "2.4.3",
    "@ngtools/webpack": "1.2.10",
    "babel-traverse": "6.23.1",
    "babel-types": "6.23.0",
    "babylon": "6.16.1",
    "copy-webpack-plugin": "~4.0.1",
    "extract-text-webpack-plugin": "~2.1.0",
    "lazy": "1.0.11",
    "nativescript-css-loader": "~0.26.0",
    "nativescript-dev-android-snapshot": "^0.*.*",
    "nativescript-dev-typescript": "~0.3.5",
    "nativescript-dev-webpack": "^0.4.0",
    "raw-loader": "~0.5.1",
    "resolve-url-loader": "~2.0.2",
    "typescript": "~2.1.0",
    "webpack": "~2.3.3",
    "webpack-sources": "~0.2.3",
    "zone.js": "~0.7.2"
  },
  "scripts": {
    "ns-bundle": "ns-bundle",
    "start-android-bundle": "npm run ns-bundle --android --start-app",
    "start-ios-bundle": "npm run ns-bundle --ios --start-app",
    "build-android-bundle": "npm run ns-bundle --android --build-app",
    "build-ios-bundle": "npm run ns-bundle --ios --build-app"
  }
}

npm --version 3.10.10 node --version v6.10.2

Here is my console logs

** ARCHIVE SUCCEEDED **

2017-10-06 12:02:02.246 xcodebuild[9622:120865] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/q1/4nbrdtn975q_8y0py9918g740000gn/T/MyApp_2017-10-06_12-02-02.218.xcdistributionlogs'.
1.2.840.113635.100.1.61
1.2.840.113635.100.1.61
1.2.840.113635.100.1.61
Exported MyApp.xcarchive to: /Users/macmini/Desktop/MyApp/platforms/ios/build/device
** EXPORT SUCCEEDED **

Project successfully built.
Installing...
Successfully installed on device with identifier ‘a11aa11a111111a11a111a1a1aa11aa1a1a11a11’.
Skipping node_modules folder! Use the syncAllFiles option to sync files from this folder.
Refreshing application...
Successfully synced application com.myApp on device a11aa11a111111a11a111a1a1aa11aa1a1a11a11.
Executing before-watch hook from /Users/macmini/Desktop/MyApp/hooks/before-watch/nativescript-dev-typescript.js
Found peer TypeScript 2.1.6
CONSOLE LOG file:///app/app.component.js:34:16: =======launchEvent=======
CONSOLE LOG file:///app/components/db-helper.service.js:24:36: DATABASE NOT CREATED SUCCESSFULLYReferenceError: Can't find variable: sqlite3_open_v2
CONSOLE LOG file:///app/tns_modules/@angular/core/bundles/core.umd.js:111:20: Angular is running in the development mode. Call enableProdMode() to enable the production mode.
CONSOLE LOG file:///app/components/db-helper.service.js:24:36: DATABASE NOT CREATED SUCCESSFULLYReferenceError: Can't find variable: sqlite3_open_v2
CONSOLE LOG file:///app/components/db-helper.service.js:24:36: DATABASE NOT CREATED SUCCESSFULLYReferenceError: Can't find variable: sqlite3_open_v2
12:03:03 PM - Compilation complete. Watching for file changes.

Here is my modulemap file ~/MyApp/node_modules/nativescript-sqlite/platforms/ios/module.modulemap

module sqlite3 [system] {
    header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/sqlite3.h"
    link "sqlite3"
    link "libsqlite3"
    export *
}

I have tried few solutions:

1) tns platform remove ios; tns platform add ios; tns run ios --device a11aa11a111111a11a111a1a1aa11aa1a1a11a11;
2) tns plugin remove nativescript-sqlite; tns plugin add nativescript-sqlite; tns platform remove ios; tns platform add ios; tns run ios --device a11aa11a111111a11a111a1a1aa11aa1a1a11a11;
3) tns platform clean ios; tns run ios --device a11aa11a111111a11a111a1a1aa11aa1a1a11a11;

None of above solution worked for me. Can anybody suggest me any workaround solution for this ?

NathanaelA commented 7 years ago

You might want to look at #50