2

I'm using this ionic cache service module, but it as some savior bug.
You can see it here (issue 42).

I can see a pull request to that bug too. Yet, it is not merged into the main branch.

Can you tell me how to use that fix with my Ionic 3 app?

Update:

I have tried npm i --save Nodonisko/ionic-cache#pull/43/headas mentioned below answer by @VonC.But the problem here is when I used npm i --save Nodonisko/ionic-cache#pull/43/head,it removes dist folder inside the node_modules/ionic-cache.Then no api details for the package and it is not working.Do you know a better way to do this?

Sampath
  • 50,641
  • 40
  • 250
  • 357
  • Possible duplicate of [npm install from github pull request](https://stackoverflow.com/questions/33181297/npm-install-from-github-pull-request) – Cortney Thomas Apr 01 '19 at 15:23

1 Answers1

-1

If you have clone the Nodonisko/ionic-cache repo locally, you can apply this pull request, even though it is not yet merged into master.
See "How to apply a git patch when given a pull number":

git checkout -b mylocalbranch
git pull origin pull/43/head

But since you used npm install, see "npm install from github pull request":

npm install <user>/<repo>#pull/<id>/head

In your case:

npm i --save-dev Nodonisko/ionic-cache#pull/43/head
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • OK, I'll do that step.But after that how can I use it with my ionic app? Because I have installed it like this `npm install ionic-cache @ionic/storage --save`.So how can I do that step then? – Sampath Jul 15 '17 at 04:50
  • Oh..Is that mean I just need to run this cmd only? `npm i --save-dev Nodonisko/ionic-cache#pull/43/head` – Sampath Jul 15 '17 at 04:54
  • @Sampath Yes, that is the idea. – VonC Jul 15 '17 at 04:55
  • I have done that step.After that, it put new entry on `package.json` file as like `"ionic-cache": "github:nodonisko/ionic-cache#pull/43/head",` under the `devDependencies`.Earlier no such entry.Only under `dependencies` like this `"ionic-cache": "^2.0.4",`.That entry still there.But the problem now is app says `[ts] Cannot find module 'ionic-cache'. on this `import { CacheModule } from "ionic-cache";`.Can you tell me what need to do now? – Sampath Jul 15 '17 at 05:10
  • @Sampath The PR would represent master+a patch, not 2.0.4, so you need to adjust your dependencies. See https://stackoverflow.com/a/23348036/6309 – VonC Jul 15 '17 at 05:14
  • Is that mean do I need to do like this on `package.json` under `dependencies` section `"ionic-cache": "github:nodonisko/ionic-cache#pull/43/head",`? After that do I need to run `npm i` again? – Sampath Jul 15 '17 at 05:22
  • @Sampath I suppose so, but I haven't try it: If it does not work, try and see what SHA1 your installed git repo is (with the applied path), and use that SHA1 instead. – VonC Jul 15 '17 at 05:24
  • I have done this `"ionic-cache": "git://github.com/Nodonisko/ionic-cache#6105ebacbb70e67bef2866bb5a31c2d83736b876",` and after that run `npm i` as a fresh install.The problem here is, it doesn't install any source code of the api. Just an empty folder and having `licens/redme/package` under the `node_modules/ionic-cache`.Hope you have a solution? – Sampath Jul 15 '17 at 06:00
  • @Sampath I don't have anything more than my previous link https://stackoverflow.com/a/23348036/6309. I can read it should work though: see also https://stackoverflow.com/a/27630247/6309. Or try https://github.com/lzrski/npm-git-install – VonC Jul 15 '17 at 06:33
  • The problem here is when I used `npm i --save Nodonisko/ionic-cache#pull/43/head`,it removes `dist` folder inside the `node_modules/ionic-cache`.Then no api details for the package and not working? – Sampath Jul 15 '17 at 06:44
  • @Sampath That I don't know: your edit describes well the problem at hand. – VonC Jul 15 '17 at 06:54