React application developed using node JS v10 - node.js

I have a main react application in which many other react applications have been developed. This was developed way before I joined. However, this is bothering me , because react applications keep coming in, and technically we keep building using nodejs10 to each new application.
Iam overthinking ?, or something can happen in the future
Can this be supported by node js?
I also considered updating all applications to the latest nodejs. But I'm fearful of the damages or if this idea is even feasible to implement?

From my personal experience, it's quite rare for a Node upgrade to break a React build.
But it all depends on the complexity of the app and the packages used and how old are the dependencies.
I wouldn't say you're overthinking, Node 10 support ended at the end of April so it would be advisable to upgrade to a more recent version.
I would ask the relevant person to have a couple of days to tackle the tech debt and try to upgrade Node to 16.
If you are using nvm you could switch to Node 16 using the --reinstall-packages-from command targeting your current version and try to build.
It's going to take you a couple of minutes.
You can always switch back to 10 with a single command.

Related

Node 12 | Reference error: FinalizationRegistry is not defined

I am trying to host a node js (express) at dream host using shared unlimited plan. I was able to do most of the work. There is only one problem, dreamhost uses passenger to run node js app, and passenger does not support node 14+, so I have to stick with node v12.
The express js project I was building is built on typescript and I used node v16 to do all of the stuff installing, running etc. When I build the typescript, it uses an npm package exit-free-leak which uses FinalizationRegistry, hence requires node v14+.
So after building the app, When I run the app.js with node v12 it gives me the error that FinalizationRegistry is not defined. For now I am getting this error, but the exit-free-leak uses another node v14+ function "WeakRef".
So my question is how do I get around this issue while using node v12 ? is there anyway to polyfill these functions or disable use of the package exit-free-leak using tsconfig.json, or maybe an even better solution.
Unfortunately the answer to "how do I get around this issue while using node v12" is probably: "you don't".
Node 12 has been end-of-life for 9 months; given how fast the JavaScript ecosystem moves in general, it's unlikely that libraries will keep supporting that version for very long anyway.
You'd be best off asking Dreamhost about Node 16 or 18 support, or move elsewhere if they can't provide you with up-to-date runtimes that still get security updates.

How to make sure React/NodeJS Project doesn't break after npm update?

Most React projects or Node js projects depend on thousands of packages, how do I make sure that my project doesn't break when I do npm update or yarn upgrade?
Also what happens when Nodejs and npm/yarn itself are updated? should I keep the Nodejs version on which my project was running in a stable state!
Let's suppose I keep the Nodejs Version the same, but in future, there would be vulnerabilities in Nodejs I would be forced to upgrade!
Is the only way to do that is to write a lot of unit tests that run automatically after every build?
What is the right way to ensure that thousands of code lines don't go to waste when packages are updated?
I want my users to have a good experience while using my website, I want to minimize the number of bugs and issues, and at the same time, I want to make sure my developers are productive and not stuck on fixing new bugs due to environment changes such as NodeJS and new packages?
Note: I am new to NodeJS, NPM, Yarn, React, and related build systems.

Could i use differents node versions between my project and specific library?

i will try to give you a little of context.
With my team we are trying to migrate MUI v3 to v4 in a reactJs project. We did it with the project itself and it works! but, some kind of problems came up when we navigated to certain windows that use a certain library to work.
This library was developed by other guy that is not in the company anymore and we are not in touch neither, but, we have access to the library GitHub repository, them are two actually.
https://github.com/rjpizarro/forms
https://github.com/rjpizarro/make-request
i've never had to do this so, i decided to clone the project then install the dependencies and run it.
I'm using nvm so in that moment i was working with node v12 and i got some errors when i executed the npm start ("start": "webpack --watch").
If i use node 10 the scrips runs perfectly but in the entire project we are using node 12 so i'm not sure what is the problem here.
i'm wonder if it could be a problem when i'll try to migrate from MUI v1 to v4 and use the modified library into my project again, or in first place, why its working rigth now?
Anyway i just wanted to know, just if i need it, Could i use different versions of node in a library and then use other newer version into the entire project?
Could this make some negatives effect into my entire project?
Which is the best way to migrate MUI into this library and put it in my project again?
Each nodejs process (including all the modules/libraries it loads) has exactly one version of nodejs running. It isn't possible to have two separate versions of nodejs in the same process each running different parts of the code.
You could make two separate nodejs apps that each run under a different version of nodejs that communicate with each other via some interprocess communication, but they have to be two separate applications/processes.
If you want to run everything in one process (on one version of nodejs), then you will need to test and fix all your libraries to run on that one version of nodejs.

Figuring out the node version of an existing Node.js Application

I have a old Node.js application that I need to rebuild it to run it using my current Node installed. I have the node_modules folder. However, I cannot figures it was created using what version of Node. I searched for the term 'engine', but I had not success. Any ideas would be greatly appreciated.
The engines property can be used to define which versions of Node your application can run on, but it is optional. Without it, there is no way of knowing what version on Node the app was developed on. You could have switched Node versions during development and if there were no breaking changes, the application would have no idea.
Something you could try to do is look at the dependencies in your node_modules/ folder - if the dependencies are the same versions that you installed when originally developing, they might have engines properties in their package.json files that you could look at and piece together a picture of what Node version the application was developed for.
If you are trying to update the app to use a modern Node version, an easy way forward is to simply run the app, see what breaks, look up documentation to see what has changed between versions, and update your code until it works as expected.
TL;DR - There is no definitive way of knowing what the Node version was when the app was developed, unless it was documented by the developer.

node blogs, screencasts, and resources to watch

I've been developing a node.js + express.js web app, but the problem I keep running into is project or blog abandonment. I realize node is still relatively new and going through some growing pains perhaps.
What are some node resources that are still active for learning how to build web apps with it?
You can try these,
http://net.tutsplus.com/tutorials/javascript-ajax/node-js-for-beginners/?search_index=4
http://www.nodebeginner.org/
http://coding.smashingmagazine.com/2011/09/16/useful-node-js-tools-tutorials-and-resources/
http://dailyjs.com/2010/11/01/node-tutorial/
http://camp.nodejs.org/videos/
http://backbonetutorials.com/nodejs-restify-mongodb-mongoose/
http://javascriptplayground.com/blog/2012/04/beginning-node-js-express-tutorial
These are my book marks for learning node. They have been helpful. But ofcourse, node changes alot, and by the time you probably read or watch some of these, there has been a new version of node. Be sure to watch the git page node, and pay close attention the the changes.

Resources