NodeJS server and React app can't use the same version of Node - node.js

Here is my problem and it might be super simple to fix, but I am new to the world of web technologies.
I have a react app that is running using node version 10.0.0. I am using npm n as my node version manager, and I am using n stable as my version selector.
When I try to run the NodeJS server that is supposed to accompany it, it fails when I try to run it with node version 10. I have to go back to version 4.9.1, so I can run the server without any problems.
Has anyone else faced this issue or know what it could be? If I go to a newer version of node I get a Bindings.js npm error. If I build my react app with 4.9.1, well that doesn't work at all.
To run both at the same time I have to switch to node version 4.9.1 and then run the nodeJS server, then change to version 10 and build the react app which to me is not how a production build should go.
Any thoughts?

Related

it is posible to install nodejs version >=14 on linux 32bits?

Im using a linux laptop 32bits and i wonder if there is a way to install nodejs version >=14 ?
Im trying to use React on VSCode and when i try to start a project it tells me i need Node 14 or higher
saberx#saberx:~/Documents/react$ npx create-react-app miapp
npx: installed 67 in 11.768s
You are running Node 9.11.2.
Create React App requires Node 14 or higher.
Please update your version of Node.
i searched on internet but cant find a way to install a higher version of nodeJs on my linux 32bits
Unlikely, Node 10 removed offical linux x86 builds (32bit).
There were unofficial/untested builds up to v12.16.2 but they ended there. I would guess they went from "unsupported" to "not possible".

Node version different when using NPM

I tried to find a duplicate question, there are similar ones but I still don't understand what's going on..
I just installed node and npm on Ubuntu 20.04 with
sudo apt install nodejs npm
And followed the Electron quick start tutorial, and added this line to the beginning of my main.js:
console.log("node version: " + process.versions["node"]);
When I run my app with npm start, I see (both on the console and on the app) node version 16.13.0, but when I run the app with node main, I see the version as 10.19.0, which is also what node -v shows.
I can probably "fix" this issue by updating node, but I would like to understand what is going on here.. Is NPM using a different node version or something?
Thanks
Edit
I tried this with an empty node app, just made npm init and set start: "node index.js" in package.json, this time both node index.js and npm start show the same version (10.19.0) so I'm guessing Electron is somehow reading a wrong node version?
#DJHemath is spot on. Electron has Node and Chromium as internal libraries. IE: Node is a module of Electron.
Therefore, the version you are seeing within your Electron application is the Node version that is bundled with Electron.
When Electron is updated, the versions of Node and Chromium are often updated as well. An overview of this can be seen on the Electron homepage "Releases" cards (latest, beta, alpha and nightly).
Additionally, for historical purposes, version updates of these two dependencies can be seen on the Stable Releases page.
Thus, in summary, changing your system's installed Node version will not affect the version of Node used within your Electron application(s).

How to use create-react-app with Windows 7

Tried to fire up a new react app yesterday using create-react-app. Unfortunately, when I used the command npx create-react-app my-app, it says "Create React App requires Node 14 or higher." However, when I try to update to Node 14 or any later version, it says Windows 8 or higher is required to update. Since I'm on a work PC, it is a slow process to get my computer upgraded to Windows 10 and might affect other software I have on my computer.
I've been trying to understand Webpack and Babel but having a lot of issues that don't pop up with create-react-app. Is there any way to use create-react-app on Windows 7?
Thanks in advance.
The current latest release of the create-react-app project is v5.0.0 where support for Node 10 & 12 was dropped.
The only solution you have here, other that upgrading to a newer version of Windows and installing Node 14 is to use an older version of create-react-app.
The newest version that supports Node 10 & 12 is v3.4.0.
You can initialise your project using the older version with this command:
npx create-react-app#3.4.0 my-app
Note that this is not the latest version, and therefore is outdated and will not include the latest features of create-react-app.
Is you want to Use Node and react Js on Windows 7 32 bit system.Then just install following versions of node and create-react-app.
use Node 13.12.0
and to create react app use create-react-app version 3.4.0
npx create-react-app#3.4.0 my-app
this is working without any error and tested till installations
Otherwise consider upgrading your system as well as your software.

what's the comand to know the Node.js version in angular's eyes(opinion)?

when I do mvn compiling for flink source code,I get:
Node.js version v9.0.3 detected.
The Angular CLI requires a minimum Node.js version of eithor v10.13 or v12.0
when I input node -v, the result is 12.18
so,what's the comand to know the Node.js version in angular's eyes?
and where does the old version v9.0.3 come from?
I restart my computer and the error remains.
Thanks for your help.
(Python3.6) appleyuchi#Desktop:~$ which npm
/home/appleyuchi/.nvm/versions/node/v12.18.0/bin/npm
(Python3.6) appleyuchi#Desktop:~$ which nodejs
(Python3.6) appleyuchi#Desktop:~$ which node
/home/appleyuchi/.nvm/versions/node/v12.18.0/bin/node
I compile and get the following message again
Node.js version v10.9.0 detected.
what do you mean by angular's eyes? There is no different node for angular. if it is installed then the node is same for all framework.
Follow this link to check Angular, Node.js and TypeScript compatibility.
https://gist.github.com/LayZeeDK/c822cc812f75bb07b7c55d07ba2719b3
You can use nvm if you want to work with multiple node versions
this link will help in using nvm
https://www.sitepoint.com/quick-tip-multiple-versions-node-nvm/

Update Node version for Meteor app deployed to Heroku

I have a Meteor application deployed to Heroku. To prevent the Denial of Service (DoS) vulnerability, Heroku suggested updating the Node.js version
for my application. I want to update the meteor version to 1.2.1 and node version to 4.8.4 on Heroku. I have set the node version in packages.json as well but it was not updated after deployment.
How can I update meteor and node on Heroku? I tried the following command:
heroku run meteor update --release 1.2.1 -a myappname
but it throws the following error:
bash: meteor: command not found
Any help would be much appreciated.
Thanks in advance!
To update my application's node version to 4.8.4, I updated Meteor version to 1.5.1 on my local machine, fixed the dependencies issues and pushed code to the Heroku application which solved the issue.
I used the following command to update Meteor version to 1.5.1 which updated the node package version to 4.8.4 as well:
meteor update --release 1.5.1
After committing and pushing code to Heroku, there were a few babel-runtime and bcrypt crashes. I executed the following commands to fix those issues:
meteor npm install --save babel-runtime
meteor npm install --save bcrypt
meteor update iron:middleware-stack.
Pushing these updates to Heroku solved my issue.
You can use the following command to update Meteor version to 1.5.1
meteor update --release 1.5.1
Command like heroku run meteor update will not work because Meteor is not installed (and is not meant to be) in the Heroku environment.
It is used in the buildpack (assuming you use the Meteor buidpack horse) to build your Meteor project source code into production version. It then becomes a "standard" node app. The buildpack also reads the node version required by the project Meteor version (not the one specified in your package.json file unfortunately) and configures your Heroku environment accordingly.
The buildpack does everything automatically from your Meteor project source code, but that also means that it is tied to Meteor (which is also understandable because any arbitrary node version may not work with Meteor).

Resources