React-native: Can't use react-native init to create new project

Created on 7 Jul 2018  路  3Comments  路  Source: facebook/react-native

Environment

Run react-native info in your terminal and paste its contents here.

C:\Users\Faris\Desktop\learn\reactNative\AwesomeProject\node_modules\react-native\local-cli\cliEntry.js:30
import type {CommandT} from './commands';
       ^^^^

SyntaxError: Unexpected identifier
    at new Script (vm.js:74:7)
    at createScript (vm.js:246:10)
    at Object.runInThisContext (vm.js:298:10)
    at Module._compile (internal/modules/cjs/loader.js:657:28)
    at Module._compile (C:\Users\Faris\Desktop\learn\reactNative\AwesomeProject\node_modules\pirates\lib\index.js:91:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Object.newLoader [as .js] (C:\Users\Faris\Desktop\learn\reactNative\AwesomeProject\node_modules\pirates\lib\index.js:96:7)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)

Description

react-native init {someproject}

to create a new project to work. this is what appear in the console

import type {CommandT} from './commands';
^^^^^^

SyntaxError: Unexpected token import
at new Script (vm.js:51:7)
at createScript (vm.js:136:10)
at Object.runInThisContext (vm.js:197:10)
at Module._compile (module.js:613:28)
at Module._compile (D:\Works\Project2\node_modules\pirates\lib\index.js:91:24)
at Module._extensions..js (module.js:660:10)
at Object.newLoader [as .js] (D:\Works\Project2\node_modules\pirates\lib\index.js:96:7)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
at Function.Module._load (module.js:493:3)

Reproducible Demo

react-native init {someproject}

20037 :- Can't use react-native init to create new project

Machine :- Windows 10 8GB RAM
Node Version :- v10.6..0

Locked

Most helpful comment

React 0.56 doesn't work in Windows ;(
nobody tested in Windows before this release
so sad ;(

All 3 comments

It was solved by react-native init --version="0.55.4" {projectName} , but i think it's a bug

React 0.56 doesn't work in Windows ;(
nobody tested in Windows before this release
so sad ;(

any updates on this?

Was this page helpful?
0 / 5 - 0 ratings