I think you're adding global dependencies wrong, and you shouldn't need to install react-native
, globally or locally. react-native init
will create a package.json
with react-native
listed as a dependency.
You should be able to install react-native-cli
globally with yarn global add react-native-cli
, not yarn add global react-native-cli
.
You should be fine with running the following:
npm install -g yarn
yarn global add react-native-cli
react-native init sample
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…