Closed
Description
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
- Install Node.js 0.12
- 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.