Minimum nodejs version?


#1

There seems to be some inconsistency in the documentation about what version of nodejs is required for serverless.

Here it says node.js v6.5.0 or later:

Here it says node v4 or higher:

Which is right?


#2

To run the Serverless Framework you need v4 or higher (as per the project’s package.json).

The quickstart link you posted involves running a Lambda function locally, so your local version should match that of your runtime. The article does look a bit out of date, because the default AWS Lambda runtime is now NodeJs v6.10.3. Note that this version is not required if you’re happy to only run the framework (and not invoke functions) locally.


#3

Thanks, but could you just clarify: I thought “sls invoke -f <function>” is not running the function locally, but actually invoking it in AWS? (The “-l” flag fetches execution logs back from AWS)

I found a separate page on “sls invoke local”:


#4

Yep, you’re right in thinking that. I was just talking about the local version because the quickstart guide you linked uses invoke local ... in Step 3.


#5

I think we must be looking at different quickstart pages.

The one I’m looking at (and linked to earlier) is https : // serverless . com / framework / docs / providers / aws / guide / quick-start /

The word “local” doesn’t appear anywhere on this page, and step 3 has:

serverless invoke -f hello -l


#6

Regardless of the actual minimum version I’d strongly recommend 6.10.x. Serverless will run on this version and it means you’re using the same version locally when building/testing Lambda. If you’re using lower or higher versions then you could end up trying to debug code remotely that is having an issue because of something as simple as different Node versions.


#7

Whoops, don’t know what I was looking at! Disregard my local comments, but the minimum version - as per the package.json - is the correct answer to your original question.


#8

OK, that’s clear now - and as I’m developing lambda functions in python, I won’t be doing any ‘invoke local’ on javascript.

But it does seem that the minimum JS requirement given in the AWS quickstart page is misleading then?

It only really matters because the nodejs version in the Ubuntu 16.04 standard repositories is 4.something. Because of the QS instructions I went hunting for the node_6.x repositories and installed from there, but it turns out I needn’t have bothered.