I'd like to be able developing a Node.JS application using the latest features of JS and Node.JS (like Node.JS v8 or even v13), but I need to deploy the app on embedded Linux server with Node.JS v4 (Omega2, OpenWRT, MIPS arch).
Is it possible somehow to build the app and make it runnable on such an old version of Node.JS?
Thank you for your answers, suggestions, and solutions!
You can use nvm to have both versions of node in the system and can run both applications in a different node version.
Related
It seems that the only way to upgrade the version of Node used by Meteor is to upgrade Meteor, according to the following:
How to change or upgrade the version of Node.js in Meteor
Update Node version for Meteor app deployed to Heroku
You can run your production bundle with other node versions, it is just not guaranteed that it will work. In practice though, I've done this many times and have never run into any issues (always using newer versions of node).
In development meteor uses the node binary in
~/.meteor/packages/meteor-tool/METEOR_VERSION/mt-os.linux.x86_64/dev_bundle/bin/
where METEOR_VERSION is the version of meteor your project is using, e.g., 1.12.1. So you could go there and replace that binary with a symlink to another node executable if you want to and it will probably work for most newer versions of node.
In development: difficult. Your Meteor project uses its own embedded Node version, and trying to change it might also require reconfiguring the dev mode build and tooling...
In production: if you have control of the server environment, then yes, you can try another Node version, at your own risks regarding compatibility with Meteor code. However the latter checks that your Node major version is at least the one required by Meteor.
In Heroku: if you use the Meteor buildpack horse, then no. The buildpack configures your Heroku environment as required by the Meteor version of your project, including the Node version.
I'm trying to understand the development process of React-Native, so I've found information about Metro, And then I've read/watch this Metro video):
Metro is the development platform for React Native and it does that by
exposing an HTTP server so clients, in this case, emulators can
communicate with it and it also exposes a Websocket server so it can
push updates into the clients.
The docs talk about the "React Native Packager" (now called Metro, according to the video) which runs on port 8081, so that is the HTTP server that starts when we type react-native run-android for example?
Regarding the Websocket I still need to read more.
The documentation says we're running our JavaScript code in two environments, depending if we're in debug mode or not, which I understood. But this article confused me a little bit, says:
No. 4 You Code Does Not Run on Node.JS: The JavaScript runtime you’ve got is ether JavaScriptCore (non-debug) or V8 (debug). Even
though you can use NPM and a node server is running on the background,
your code does not actually run on Node.JS. So you won’t be able to
use of the Node.JS packages. A typical example is jsonwebtoken, which
uses NodeJS’s crypto module.
And, then I've read things like:
React Native uses Node.js, a JavaScript runtime, to build your
JavaScript code.
Node.js is a server-side JavaScript runtime environment. React
Native ships with some tools that are written for Node.js.
Node.js is an open source platform built on Chrome's JavaScript
runtime; it offers a way to easily build fast, scalable
programs. Node.js allows you to run JavaScript in Terminal, and helps
create modules.
In this article, it says:
Download node.js from nodejs.org. This JavaScript runtime gives you
access to npm, which is a convenient tool created by the node.js
project that you can use to manage open source packages. Make sure
that you download the latest LTS (Long Term Support) version of
node.js. Also included with this download is a development server
called the Metro bundler, which provides live updates when debugging.
So:
The role of Node.js in RN is to only access npm and manage the packages? and is Metro is includes in Node.js? Am I missing/confusing something? Thank you.
There are four types of JavaScript you'll write in todays environments:
1) Clientside browser JavaScript:
That's what gets sent to webbrowsers when they visit your webpage, it then gets executed in the browser at the clientside. As you want the JS to load fast and run on all kinds of browsers, you usually use transpilers to turn the modern ESnext you write into a minified version with better support.
2) Clientside native JavaScript:
Most devices do have a native JS runtime, therefore you can ship JS files with your Android / iOS / Desktop application and then start them there. These engines also support adding hooks from JavaScript into your native code, that's how React Native does provide it's APIs.
3) Serverside NodeJS JavaScript:
NodeJS is a runtime you'll use to run servers.
4) Buildscripts running on NodeJS:
You can use JavaScript to generate JavaScript files. That's how you bundle the files for (1) and (2) (maybe also (3)).
Now metro is a serverside buildscript (on NodeJS) that you can use to either a) start a server that serves your JS as a webpage (1 & 3), or b) that bundles your JS in a native App that you can install on your device (2).
The role of Node.js in RN is to only access npm and manage the packages?
No. metro is itself a package that you then run on NodeJS.
So my question is pretty straight forward. I am using Electron js and python to create a desktop application. The problem I have though is that the application would make use of a couple of python packages and selenium. Is there a way to compile those packages in such a way that the user of the desktop app wont need to install python and the packages on their system to use the desktop app?
You could use py2exe and py2app for Windows and Mac. Linux and MacOS should already have python installed though. These allow you to make executable python applications that do not require python to be installed on the users' computer.
I hope this helped :)
What type of server/service type supports Node.JS applications?
Is we need to install node/npm on server.
Does it need to be a dedicated server?
Thank you in advance.
I don't think you need anything special, even a random Raspberry PI with linux can host NodeJS app.
Since node.js have executable on Linux, Windows and Mac, the hardware will not be limited by what can run node.js, but by what your script need, and the workload you expect.
If you run a basic website with little trafic, a RPi will be enought, if you were to port Facebook or Google to node.js, you would still need complete dataserver.
So the only limit is third party utilities and your own knowledge of the platform you use.
Node.js Application can be hosted on Linux,Windows or any other O.S. And for node.js Application there is basic minimum setup is required. like Node.js , git bash, npm etc.
you can follow this link
I have heard about Node.js being used in the frontend side of the application as opposed to the backend side, but I cannot find any use cases for which it can be used. Can somebody explain the use cases for which Node.js is used in the frontend.
Also for a fairly complex system such as a CMS(Content Management System) for an e-commerce site, would Node.js be the right choice?
Thanks in advance
Node.js is a javascript runtime that uses the Chrome V8 javascript engine. The front-end already uses a javascript engine on the browser (V8 for Chrome, SpiderMonkey for Firefox, Chakra for Edge), so whether Javascript is running in the browser on in Node.js, you can expect very similar environments.
However, you might be interested in using Node.js modules on the front-end. The modules are packaged using a tool called npm. You can use module loaders or bundlers like Browserify, webpack, or Rollup.js to accomplish this.
You'd usually use Node.js and its ecosystem as part of your toolchain when developing frontend applications, but the deployed application will still be regular JavaScript that runs in the user's browser. You can use Node's package manager npm instead of Bower for managing your frontend dependencies, for instance.
And there's Browserify which will let you use npm packages that were designed for Node in your frontend JavaScript application (that runs inside the user's browser).