5

I do not have Node.js installed on my machine.

I have been given the source code of an application that is coded in Node.js, Express and AngularJS.

To determine the Angular.js version like any other client side javascript library I can just open the filename and get the version.

In the root folder of my application there is a node_modules folder but there is nowhere I can see what version of Node.js it is for. It does have a debug subdirectory that contains Node.js but opening the file doesn't show me the version number.

When I go to the Node.js website it gives me two version options: 4.5 or 6.5. Which one should I use if I don't even know the version the source code is written in?

4
  • Check node version by node -v if you have installed Node.js Commented Sep 13, 2016 at 14:40
  • As mentioned in the first line of my question I have not installed node.js Commented Sep 13, 2016 at 14:46
  • Then you have to install node.js first you can refer official site for specific OS nodejs.org/en Commented Sep 13, 2016 at 14:51
  • As I asked which version of Node.js should I install? One node.js site there is a 4.5 and 6.5? Commented Sep 13, 2016 at 16:44

1 Answer 1

2

Since node.js is not bundled with the source code you have to find out yourself. Is there a package.json in the application's root directory? The desired node.js version might be declared at "engines". Beside that the dependencies of your application might have some requirements. So installing node.js 4.5 LTS and running npm install might give some insight.

Are tests present? If there's a reasonable code coverage, running them could give you some safety in guessing if every feature will work with your installed version of node.js.

Usually the dependencies listed in your package.json will dictate the node version you have to use. So if npm install works you're off to a good start. An exception may be if the original author used ES6 features, which means you have to run a quite recent version.

Sign up to request clarification or add additional context in comments.

4 Comments

I looked at my packages.json and there is no "engines" section. Can at least see the Express version"express": "4.13.0",
@choba78 4.13.0 is quite recent (Jan 2015 github.com/expressjs/express/releases). I would try the 4.x LTS version of Node.js.
So can I assume the 4X versions backwards compatible with earlier 4X versions?
@choba78 See semver.org for an explanation of semantic versioning. Minor Updates add functionality but stay backwards compatible. But your best bet is to just try and test until you are sure your app works with the chosen version of nodejs.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.