Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
963 views
in Technique[技术] by (71.8m points)

can't create project using react-native init

I am getting this error again and again when creating a new project using react-native init. I reinstalled react-native cli and tried again but no luck. Can someone please tell me is there anything I can do?

enter image description here

I have following versions installed react-native-cli: 2.0.1 react-native: 0.56.0 node: 10.6.0 npm: 6.1.0

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This error is may be because of react native version React native 0.56

Here is the link about the discussion of this issue React native 0.56.* - "Unexpected identifier"

So they suggest us to downgrade the version of react-native React Native Version List

So open the file of your project named as package.json

inside it you can find react-native": "0.56.4" replace this version with react-native": "0.55.4" or what ever the version you want

then save the file

go to the terminal or power sell

rich to the your project directory and run the command npm-install

after installation check the version of react-native by running the command react-native --version and make sure that version is which you changed in package.json

restart your project and you are ready to go without this error


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...