Hyperledger Composer, Ionic Front End, React Front End, npm environment change .gitignore

in blockchain •  5 years ago 

Hyperledger Composer and Ionic Front End npm environment change .gitignore

1_DLlcakGkLkSOdsWjZrgKQQ.png

Hyperledger composer and Ionic Framework both depend on nodejs. Although I know all of us have encountered the problem of the node_modules and package-lock.json mess when we change of environments. Let’s say that that you are running an application that has a component of Hyperledger Composer as Back End and the interface is an ionic project. We add and delete npm libraries and then we either pass it to other developers of we change to a machine that has another firmware, OS, call it as you want. The point is that you guys know what happens. The npm install could mess entirely the node-sass libraries or some version could change that affects all the compilation. I have had run into so many times into this problem that just recently realized why I wasn’t using .gitignore or why didn’t work.

If that happens to you, maybe what I did could help you.

  1. We have to untrack or delete the unnecessary files that are already in the repository. With the following commands(I took this link as a reference):

    echo “:path_to_ignore” >> .gitignore //To add the path of file or folder we want to ignore

    **git rm — cached :path_to_untrack **//It deletes the cache o untrack those files. If you want to untrack folders use **rm -rf. **Alternatively, you can use these form(reference): git rm -r — cached path

  2. That’s all!!!. We now can commit the changes or use Visual Code or any other IDE to upload those changes to untrack the unnecessary files and folders that mess with our compilation.

    git add .gitignore

    git commit -m “Ignoring…”

The important files from my experience to be ignored are node_modules and package.json in each of the folders you run a server or front-end that uses nodejs.

Update

I also run into problems when dealing with React projects and .gitignore so in React I recommend ignoring the *yarn.lock *which from my understanding is the equivalent to package-lock.json.

That’s all for this small post. Hope this solution can help someone. Any comments are welcome.

Victoria, BC, Canada, December 18, 2018

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in:
https://medium.com/@nemesis1346/hyperledger-composer-and-ionic-front-end-npm-environment-change-gitignore-8efd66299561?source=rss-dc94c092a4d------2