'package.json and remote git repository

In my package.json I have defined a GitHub repo as a dependency.

  "dependencies": {
    "react": "^16.3.0-alpha.1",
    "react-native": "0.54.0-rc.3",
    "react-native-maps": "https://github.com/Stophface/react-native-maps-0.20.1.git"
  },

I cloned this repo locally onto my computer, make changes in the code and push them to the repo. I then want the changes to reflect in my project. Therefore I delete the node_modules folder and then reinstall the node_modules with yarn install. However, the changes I made in the code are not played back locally...

I even can do

yarn add https://github.com/Stophface/react-native-maps-0.20.1.git or yarn add https://github.com/Stophface/react-native-maps-0.20.1.git#refator-1 and the files I created are not there.

It works with npm install https://github.com/Stophface/react-native-maps-0.20.1.git though.

Why is that? I see the files I created locally online in the repo. When I type yarn install they should be installed locally too, right?



Solution 1:[1]

it is because of the npm cache.. add a tag (ex: v0.0.1) to your commit:

git tag v0.0.1
git push origin           // push changes
git push origin --tags    // push tags

and in your dependencies write:

"dependencies": {
  "react": "^16.3.0-alpha.1",
  "react-native": "0.54.0-rc.3",
  "react-native-maps": "github.com/Stophface/react-native-maps-0.20.1#YOURTAG"
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jeremy Caney