Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check-node-version #5520

Closed
wants to merge 1 commit into from
Closed

Add check-node-version #5520

wants to merge 1 commit into from

Conversation

shuding
Copy link
Member

@shuding shuding commented Oct 24, 2018

Fixes #5508

Copy link
Contributor

@HaNdTriX HaNdTriX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to use the engines field from the package.json for that.

const NODE_VERSION = process.version.match(/^v(\d+)/)[1]

if (NODE_VERSION < 7) {
printAndExit(`> You're using Node.js with version less than 7 which is not supported. Please upgrade to Node.js >= 7.`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Node.js 7.5+ is supported

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there should be defined version 8 as minimal. Automated tests with TravisCI have also version 8 as minimum.

@@ -1,4 +1,8 @@
// @flow

// Check node version before including other dependencies
import '../server/lib/check-node-version'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 This should probably be used in next-server/server/next-server.js instead.

@radeno
Copy link
Contributor

radeno commented Oct 28, 2018

Agree with @HaNdTriX to not polluting code with version checking. Just define it in package.json
https://docs.npmjs.com/files/package.json#engines

@timneutkens
Copy link
Member

Even if someone force installs it / npm only shows a warning we should show a clear message instead of erroring out with a random stacktrace

@radeno
Copy link
Contributor

radeno commented Oct 28, 2018

@timneutkens i agree, but package.json is first place where people will search dependencies. even engine dependencies. like in Gemfile in Ruby

@timneutkens
Copy link
Member

I'm not saying we shouldn't add engines, we definitely should 👍

@radeno
Copy link
Contributor

radeno commented Oct 29, 2018

@timneutkens should we check just node or also package managers? minimum version for node is 7.5 an up, right?

timneutkens pushed a commit that referenced this pull request Nov 3, 2018
Based on this PR #5520 there should be `engines` definition in package.json as first warn.

Why i choose Node 8 as minimum? @timneutkens said (https://github.com/zeit/next.js/pull/5520/files#r228330327) that next.js should work on version 7.5 but automated tests in TravisCI are with versions 8 and 10. Version 7 was development branch. I think only production ready should be recommended.
@timneutkens
Copy link
Member

Closing this in favor of #5724

@lock lock bot locked as resolved and limited conversation to collaborators Nov 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documentation enhancement for getting started section
4 participants