简体   繁体   中英

Error during creating react native init command

I am new to the developing field and I planned on learning react native. I installed all the necessary components but i am getting an error when copying the template. What should I do?

C:\Users\hp>react-native init MovieBooking

√ Downloading template

× Copying template
error Error: Cannot find module 'C:\Users\hp\AppData\Local\Temp\rncli-init-template-0lrjGr\node_modules\react-native\template.config'

Require stack:
- C:\Users\hp\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\init\template.js

- C:\Users\hp\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\init\init.js

- C:\Users\hp\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\init\index.js

- C:\Users\hp\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\index.js

- C:\Users\hp\node_modules\react-native\node_modules\@react-native-community\cli\build\cliEntry.js

- C:\Users\hp\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js

- C:\Users\hp\node_modules\react-native\cli.js

- C:\Users\hp\AppData\Roaming\npm\node_modules\react-native-cli\index.js
[enter image description here][1]

Basically open terminal run a administrator if that won't work, I think general problem with the latest version, Am i right you try use latest react native version?

you can try as below code;

npx react-native@0.60.0-rc.1 init --template=react-native@0.60.0-rc.1

or you wanna use typescript

also i found that's

https://github.com/react-native-community/react-native-template-typescript/issues/38

https://github.com/react-native-community/cli/issues/595

UPDATE

Try re-installing react-native CLI then

That's a version bug detail this link for solution you can downgrade you react native version before 0.60 like that

react-native init ProjectName --version="0.59.9"

This works for me

npx react-native init yourappname --template react-native-template-typescript

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM