Skip to content

Incorrect error is shown when unsupported Node.js version is used #4665

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

Closed
rosen-vladimirov opened this issue May 31, 2019 · 0 comments
Closed
Assignees
Labels
Milestone

Comments

@rosen-vladimirov
Copy link
Contributor

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 5.4.0
  • Cross-platform modules: Not applicable
  • Android Runtime: Not applicable
  • iOS Runtime: Not applicable
  • Plugin(s): Not applicable

Describe the bug
When you have a non-supported Node.js version CLI must show error describing the problem. Currently, when Node.js 0.12 is used for example, executing any CLI command leads to following error:

D:\Work\nativescript-cli\scratch>node.exe ..\bin\tns
D:\Work\nativescript-cli\lib\common\verify-node-version.js:39
        console.warn((`${os.EOL}${nodeWarning.message}${os.EOL}`).yellow.bold)
                      ^
SyntaxError: Unexpected token ILLEGAL
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (D:\Work\nativescript-cli\bin\tns:8:1)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)

In fact the error should be:

Node.js '0.12.18' is not supported. To be able to work with NativeScript CLI, install any Node.js version in the following range: >=8.0.0 <12.0.0.

To Reproduce

  1. Install Node.js 0.12
  2. Run any CLI command

Expected behavior
CLI should print:

Node.js '0.12.18' is not supported. To be able to work with NativeScript CLI, install any Node.js version in the following range: >=8.0.0 <12.0.0.

Sample project
Not applicable

Additional context
CLI has some specific code to verify the used Node.js version. The code should be pure ES5 JavaScript in order to be working with very old Node.js versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants