Just to clear the air once and for all, how exactly do you update npm packages in your working repository? - reactjs

Apologies if this is a basic question, I 'somewhat' know how to do it but at the same time do not and have scoured the internet for answers and none of the solutions seem to work.
Specifically, I am asking in regards to when github tells you that you have a security alert and must update a dependency in your package-lock file. How exactly do you solve this in your working repository? I am trying to simply update the necessary packages in my React.js repository and then push the package-lock file onto the master branch but cannot figure out a simple quick solution to do this.
Thank you very much in advance.

You'll want to use npm update <package> --save, that will update to the newest version and save that version to your package.json
https://docs.npmjs.com/cli/update.html

Related

How can I fix an issue with create-react-app where only node_modules, package.json, and package-lock.json are created?

I know there are other previous posts on this. However, they are from a few years ago, making them somewhat outdated. The issue I am having just started as of May 2, 2022.
If I run npx create-react-app my-app, the only thing that gets created is the folder and two files mentioned in the question title. I've spent over an hour trying previous solutions to other questions and using other sources, but the issue is still not resolved. I was wondering if anyone could help me?
Thanks
This is hard for me to answer without knowing the stack you have installed on your computer, however based on the information provided, you could be on your way!
From your terminal, I would try to navigate into the new app by:
`cd my-app`
Then, to start the server, run:
`npm start`
Here are some resources that I think will help you in your scenario:
https://reactjs.org/docs/create-a-new-react-app.html
Good luck buddy!

how to properly push to github using build? [duplicate]

This question already has answers here:
Blank page after running build on create-react-app
(17 answers)
Closed 1 year ago.
I'm a newbie to both git and AWS.
I bought a domain using AWS and have connected it to a Github repository.
I pushed the app to repository without initiating an npm run build.
After realizing that the website was showing the readme.md instead of the index.html which is inside of the public folder (not that that's working either), I decided to try to run npm run build and push that to the github repository, thinking that maybe that could fix my issue.
The problem I ran into was that /build is ignored inside .gitignore.
So I'm not sure if I should remove /build from .gitignore or find a work around, or something else I'm not aware of?
I would really appreciate some explanation from someone on that issue.
Thank you in advance.
So, there are 2 different things that we must break down from this question . One related to git itself and other is to the app build.
.gitignore tells git which files (or patterns) it should ignore. It's usually used to avoid committing transient files from your working directory that aren't useful to other collaborators, such as compilation products, temporary files IDEs create, etc. It basically does keep track of the specified file or directory
More related to that can be found in here:
http://git-scm.com/docs/gitignore.
Now, going to the original problem (which is building your app) github does have a CICD pipeline called github actions which essentially allows you to create a workflow based on a template that can help building your app. Therefore the build can be done when your is code is pushed, without have to send unnecessary files to your remote repository from your local npm run build. (You can find more related to this subject in this link:
https://docs.github.com/en/actions/guides/building-and-testing-nodejs?learn=continuous_integration)
That doesn't necessary solves your issue with your App (because we are not discussing anything related to coding), but if your problem is just building the app that would be a starting point.
My other recommendation would be also to check more on how git/github actually works and how you can take advantage of these systems in the future to deploy/control your code.
Hopefully this can help!
Found the answer to my question here. Thanks for the help guys.
Blank page after running build on create-react-app

React Native: NPM Module being uninstall each time a new is installed

I am using a package named react-native-linear-gradient which can be found here. I had to go through quite a lengthy process to eventually get the link to my project (by manually linking via the Binary link with libraries in XCode. I got it working fine, however, each time I install a new package via NPM, linear-gradient is removed from my node-modules folder.
1.Can anyone shed some light on why this is happening? (Happy to provide additional information)
2.Will this impact deployment of the application if this is not solved?
SOLVED: Downgraded to 5.7.1... It seems 5.8.0 seems to cause the same error Michael mentioned.

Using Quick Install in Visual Studio doesn't actually add the packages to your project

Hello I'm trying to use the Visual Studio extension Quick Install Package to install packages via bower and npm. One example is angular-loading-spinner
When I give the command using the interface, I see that the package.json file is updated and or the bower.json file is updated with the package dependency, but I'm still unable to actually reference the packages as instructed in my html using the tags. No actual files are added to the project, so I feel like I'm really missing something here, or simply don't understand what this package installer is actually meant to do. There doesn't seem to be any clear tutorial on this I can find online, or any good information. It just all assumes it works fine. Can anyone please advise? Thanks]1
Mike, I'm glad to know that my answer was the correct. For future users that have the same concern, they need to look at the folder node_modules to find out all the libraries installed.
This was put in the node_modules folder as pointed out by Jonathan Brizio. The issue was that the files were hidden and had to be included in the project.

AngularJS tutorial - missing web-server.js file, attempting to follow instructions exactly

I am attempting to follow the AngularJS tutorial.
The documentation specifically mentions using nodejs to start a basic server. See http://docs.angularjs.org/tutorial/ step 5: "you can use node to run scripts\web-server.js, a simple bundled http server."
That's great, but web-server.js is not part of the angular-phonecat project. I followed the instructions exactly. The file is even missing from the from the master repo on github: https://github.com/angular/angular-phonecat/tree/master/scripts
So, could someone please either A) provide the web-server.js file, or B) tell me what I'm missing.
Thanks
As far as I understand they use http-server like dependency for npm.
So after
npm install http-server -g
you can simply run
node http-server
UPD:
found even more simple way - run in project dir:
npm start
Same thing for me! There was a revision that deleted this file, so I checkout out the earlier revision and have copied the web-server.js from it: 7b1d98830f5f7780108da3755b84c2713be3eb44
The answer is simple - the tutorial is changing and web-server.js is no longer needed. However, I started the tutorial before it was updated to reflect the change.
Thanks everyone for looking into this.
Run the Command ng add #nguniversal/express-engine this will create server.ts file.
Try to execute the node scripts/web-server.js with administrator access. (command)

Resources