0

I have Ionic 2 project in macOS, using Visual Studio Code to edit, and ionic cli command line commands to compile and run it. It was working, fine, but now I want to edit this project in my windows PC, using Visual Studio 2017. For that, I created a new project using Ionic 2 template available in visual studio, and then copied the source code from mac to this new project. I notice one thing: In MacOs, SQLite was referenced throught the following command:

import { SQLite } from '@ionic-native/sqlite';

But visual studio was not recognizing this reference, even after installing sql lite plugin. Visual Studio offer a command to include the import command to me, when I did that, it added the following sentence:

import { SQLite } from "ionic-native/dist/es5";

why are this commands different between mac and pc? I'd like it to be the same, so i could edit the same code in Mac and PC.

1 Answer 1

1

These commands shouldn't be different between mac and pc. There are two steps neccessary to install the SQLLite Plugin:

1) ionic cordova plugin add cordova-sqlite-storage
2) npm install --save @ionic-native/sqlite

At first please check if you find the folling package in your node_modules folder:

node_modules\@ionic-native\sqlite

If thats not the case, you should run npm install (step 2).

Otherwise Visual Studio is not referencing your node_modules folder correctly. I'm using VS Code, where you can explicitly specify where your node_modules folder is (if its not already imported)

Sign up to request clarification or add additional context in comments.

1 Comment

That solved my problem. I added the plugin through visual studio, but wasn't able to reference it in code. But after a did a "nom install --save..." it was all ok.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.