Vince Banzon
Vince Banzon

Reputation: 1499

ionic Object(...) is not a function even after reverting form git

I have a working application just a few minutes ago. Then I installed some packages from SQLite, and Storage. Until I got this error:

Object(...) is not a function

I must have not installed them properly so I tried to revert back from my previous git commit that I'm sure was working but after doing so, I still got the same error. I'm not sure what to do, I already reverted back my codes.

I even restarted my ionic server and even my computer.

I also tried to remove my node_modules folder but still has the same error.

If you need more details please let me know.

Upvotes: 0

Views: 113

Answers (1)

Vince Banzon
Vince Banzon

Reputation: 1499

Then I was able to get it work again. Phew!

(I went back to the latest commit with the error I had to try fix it)

I deleted my node_modules folder again. Then, in my package.json, I used the previous version numbers I had from my previous commit. Then run $ npm install command.

You can get the idea from here that I could have reverted back from my recent working commit, deleted node_modules folder, then $ npm install.

With this in mind, I also removed the ~ and ^ for the versions, so I won't have that issue again.This depends on your strategy though, this can be either good or bad.

But come to think of it, I installed a line of code with this command npm install @latest or was it ionic cordova plugin add ...@latest.

npm install --save @ionic-native/core@latest

While creating this answer, I decided to try and install it again just to make sure if the error would occur again but it didn't. It didn't even occur with just

npm install --save @ionic-native/core

I'm not sure anymore what could have caused it but now it's working as it should be. I'll leave this here for reference to others.

Upvotes: 0

Related Questions