Open ethansaxenian opened 3 years ago
Thank you!!
Get Outlook for iOShttps://aka.ms/o0ukef
From: Ethan Saxenian @.> Sent: Friday, July 16, 2021 1:03:37 PM To: ProfessorAmanda/econsimulations @.> Cc: Byker, Tanya S. @.>; Assign @.> Subject: [ProfessorAmanda/econsimulations] Git/npm Cheatsheet (#136)
Here is a list of useful commands to know:
To view the site on branch_name:
git checkout branch_name git pull npm start
If you get a module not found error:
npm install npm start
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FProfessorAmanda%2Feconsimulations%2Fissues%2F136&data=04%7C01%7Ctbyker%40middlebury.edu%7C10419c58fa6b44a42f8608d9487ba7af%7Ca1bb0a191576421dbe93b3a7d4b6dcaa%7C1%7C0%7C637620518189496367%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=QDPoVYG2I%2BPfZbeqtoODeXFIDRJ9unKoPbOKFUX93BY%3D&reserved=0, or unsubscribehttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAP65VZ7O7ODV6AK45GRY4ZLTYBQ6TANCNFSM5AP5ZHVQ&data=04%7C01%7Ctbyker%40middlebury.edu%7C10419c58fa6b44a42f8608d9487ba7af%7Ca1bb0a191576421dbe93b3a7d4b6dcaa%7C1%7C0%7C637620518189506364%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=nzZ1xpOauPU9Whzswcb1CRD6jmVuivbS3fGnOtdmW%2Fk%3D&reserved=0.
@tbyker if you want to check out the 3d plot, it is on the branch named 3d-regression
. You will most likely need to run npm install
before npm start
see screen shot ^^^^ which branch is beta distributions on? And I don't see the 3d-regression branch...
Beta distributions is on master
.
You should still be able to run git checkout 3d-regression
. Let me know if it doesn't work.
Hi. I am trying to look at the master and getting this error:
I did:
git checkout master git pull npm install npm start
Yikes, that's a bug, and it's also on the deployed website. I'll fix it and let's get it deployed quickly
Maybe the bug affects all branches? I was trying to look at the 3-d stuff (using the 3d-regression brand) and after spinning a long time I got this... No rush if you are working on the other stuff.
The bug should now be fixed on the master branch! Just run git pull
Oh just saw that second bug, no idea what that is...
should i just try again?
Tanya Byker
Associate Professor, Economics
Middlebury College @.**@.>
From: Ethan Saxenian @.> Sent: Thursday, July 29, 2021 11:06 AM To: ProfessorAmanda/econsimulations @.> Cc: Byker, Tanya S. @.>; Mention @.> Subject: Re: [ProfessorAmanda/econsimulations] Git/npm Cheatsheet (#136)
Oh just saw that second bug, no idea what that is...
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FProfessorAmanda%2Feconsimulations%2Fissues%2F136%23issuecomment-889224472&data=04%7C01%7Ctbyker%40middlebury.edu%7C076ead209ac648b00fe508d952a26c52%7Ca1bb0a191576421dbe93b3a7d4b6dcaa%7C1%7C0%7C637631679814773145%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=PSjIHyyRHN2umZS5Dw91hid8XoyaiNWSJzs5w4loLVE%3D&reserved=0, or unsubscribehttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAP65VZZFBPSLYGGN32YFFJTT2FU6ZANCNFSM5AP5ZHVQ&data=04%7C01%7Ctbyker%40middlebury.edu%7C076ead209ac648b00fe508d952a26c52%7Ca1bb0a191576421dbe93b3a7d4b6dcaa%7C1%7C0%7C637631679814783145%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=onExRm6TPzhVRQZp2XVlakxsfPdA0mQmbw%2FHqcC5eGo%3D&reserved=0.
For deleting old branches still stored locally: To delete a branch locally, run git branch -d [branchname]. Alternatively, I just did a quick google search and found this command: git branch --merged | egrep -v "(^*|master|development)" | xargs git branch -d, which should delete all old local branches (source).
For deleting old branches still stored locally: To delete a branch locally, run git branch -d [branchname]. Alternatively, I just did a quick google search and found this command: git branch --merged | egrep -v "(^*|master|development)" | xargs git branch -d, which should delete all old local branches (source).
Did the command work?
Yes, perfectly! Just thought I would store those commands here to close that other issue.
Great!
Some directions for the future, in case I merge a change from Dependabot that ends up breaking something. (Also directions here for pushing changes from my local).
If Dependabot install something you don't like after you merge a pull request, edit the package.json file in your local to roll back the version. Then do npm install in terminal. git status will show you what has been modified. To "transmit" these changes to the online repository, there are three steps: 1) Stage: 2) Commit 3) Push. To stage the changes, "git add ." Then check git status to see it green. To commit, type git commit -m 'whatever message you want'. Finally, git push.
Hi Wayne, this issue would be a good place to put updated npm commands and other instructions for us. Thanks!
I’ve borrowed Ethan’s cheatsheet and made several changes – the most parts are still the same! I put [NEW] in front of the commands that are changed.
I’ve also added a deployment section for the deployment workflow.
git branch
- displays a list of all branches in the project. The current branch will be marked with an asterix. Quit the view by hitting ‘q’.git checkout branch_name
- switches to the branch named "branch_name"git pull
- updates the local repository with the most recent changes on the current branch.npm install --legacy-peer-deps
- installs all dependencies described in package.json
locally.
npm install
gives us an error. We need to append --legacy-peer-deps
to any npm package management instructions. Thus, we should use npm install --legacy-peer-deps
.npm run dev
- starts the development server*branch_name
:git checkout branch_name
git pull
npm run dev
module not found
error:npm install --legacy-peer-deps
npm run dev
git branch --merged | egrep -v "(^*|master|development)" | xargs git branch -d
master
branch into deployment
branch (the direction is important!)Hi Wayne, I'm getting some errors when I try to run this locally. I started by running "git pull" for the master branch, then running "npm install --legacy-peer-deps". When I then tried to run "npm run dev," I error that said something like "dev not found." Then I just ran it using "npm start," and was able to run it locally. However, then when I ran "git pull" to make sure everything was up to date, I got an error "error: Your local changes to the following files would be overwritten by merge: package-lock.json Please commit your changes or stash them before you merge." Can you recommend a next step?
Hi Amanda,
It seems like react changed something in package-lock.json and that prevents a git pull. Let's try git stash
before git pull to get rid of local changes. So please try:
git stash
git pull
npm install --legacy-peer-deps
npm start dev
Hope it works!
Okay, I was able to run it! But when I try to check out another branch, I get an error: "error: Your local changes to the following files would be overwritten by checkout: package-lock.json Please commit your changes or stash them before you switch branches. Aborting."
I'm going to stash the changes for now, and we can maybe chat during our meeting.
Hey Wayne, I got this error again just now when I tried to check out NormalDistribution: "Midd-19529:econsimulations agregg$ git checkout NormalDistribution error: Your local changes to the following files would be overwritten by checkout: package-lock.json"
Do you think there might be a tweak we need to make to package-lock.json to make everything agree? There might just be a version number or something that differs among our versions of the repo. I see this warning when I run the npm install step: "npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!"
For now I've just stashed the changes again to see what's up with NormalDistributions.
Thanks for the detailed error message. I did a little research and it seems like that there's a difference between the node version of your computer's environment and the node version of our project. I'll try finding potential solutions for us to try out next time we meet. For now, stashing them should be ok.
Btw my issues with package-lock.json seem to have resolved? At least, I'm not having any problems or needing to stash changes when I work with the NormalDistribution branch.
I'm not sure what the root cause was, but I'm glad it's not there anymore! If it still occurs with other branches, we can try several solutions next time when we meet.
Here is a list of useful commands to know:
git branch
- displays a list of all branches in the project. The current branch will be marked with an asterixgit checkout branch_name
- switches to the branch named "branch_name"git pull
- updates the local repository with the most recent changes on the current branchnpm install
- installs all dependencies described inpackage.json
locallynpm start
- starts the development serverTo view the site on
branch_name
:If you get a
module not found
error:To delete all outdated local branches: