File tree 1 file changed +20
-11
lines changed
packages/create-react-app
1 file changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -193,6 +193,26 @@ function createApp(
193
193
useTypescript ,
194
194
template
195
195
) {
196
+ const unsupportedNodeVersion = ! semver . satisfies ( process . version , '>=8.10.0' ) ;
197
+ if ( unsupportedNodeVersion && useTypescript ) {
198
+ console . log (
199
+ chalk . red (
200
+ `You are using Node ${ process . version } with the TypeScript template. Node 8.10 or higher is required to use TypeScript.\n`
201
+ )
202
+ ) ;
203
+
204
+ process . exit ( 1 ) ;
205
+ } else if ( unsupportedNodeVersion ) {
206
+ console . log (
207
+ chalk . yellow (
208
+ `You are using Node ${ process . version } so the project will be bootstrapped with an old unsupported version of tools.\n\n` +
209
+ `Please update to Node 8.10 or higher for a better, fully supported experience.\n`
210
+ )
211
+ ) ;
212
+ // Fall back to latest supported react-scripts on Node 4
213
+ version = 'react-scripts@0.9.x' ;
214
+ }
215
+
196
216
const root = path . resolve ( name ) ;
197
217
const appName = path . basename ( root ) ;
198
218
@@ -222,17 +242,6 @@ function createApp(
222
242
process . exit ( 1 ) ;
223
243
}
224
244
225
- if ( ! semver . satisfies ( process . version , '>=8.10.0' ) ) {
226
- console . log (
227
- chalk . yellow (
228
- `You are using Node ${ process . version } so the project will be bootstrapped with an old unsupported version of tools.\n\n` +
229
- `Please update to Node 8.10 or higher for a better, fully supported experience.\n`
230
- )
231
- ) ;
232
- // Fall back to latest supported react-scripts on Node 4
233
- version = 'react-scripts@0.9.x' ;
234
- }
235
-
236
245
if ( ! useYarn ) {
237
246
const npmInfo = checkNpmVersion ( ) ;
238
247
if ( ! npmInfo . hasMinNpm ) {
You can’t perform that action at this time.
0 commit comments