react-native及npm install 安装问题

本文分享了作者一个月内从Swift转向React Native的学习经历,包括学习资源、遇到的问题及解决方法等,特别介绍了从WebStorm切换到Atom编辑器的过程。

我们项目中已经开始用react-native,所以swift学习放下一段时间,学了一个月的rn,今天分享记录学习过程:)

学习资料整理:

1、react-native  中文网:http://reactnative.cn/docs/0.27/getting-started.html (推荐,有问题看官方文档)

2、github上面的学习资料:https://github.com/reactnativecn/react-native-guide(汇集了各种rn学习资料)

3、http://www.ruanyifeng.com/blog/2015/03/react.html(阮一峰的教程)

------------------------------------------------------------------------------------------

使用工具:我原先用的webstrom,现在改为阿童木,我发现阿童木的联想功能要比webstorm要强一些。我学完基础控件之后,30天webstrom使用刚好到期,我更换了阿童木,发现挺好用:)

一、分享自己的学习历程(目前是iOS版为主)

1、安装环境,webstrom,学习基础控件。

2、看别人的代码:安装别人的项目时,出现问题,npm install无法执行的问题,做法如下:

错误如下:


背景:我用brew安装的node  用node --version安装的时候,发现版本是4.4.5。

所以将node卸载,重新用nvm安装:参考链接如下:http://linyehui.me/2016/03/03/reinstall-nodejs-on-osx.html

注意点:安装nvm之后,将终端全退,重新打开,才会有nvm 

在项目的根目录下执行 npm install 安装成功






ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: react-native-harmony-tester@1.0.0 npm ERR! Found: react-native-gesture-handler@1.10.3 npm ERR! node_modules/react-native-gesture-handler npm ERR! peer react-native-gesture-handler@"*" from react-native-tab-view@2.16.0 npm ERR! node_modules/react-native-tab-view npm ERR! react-native-tab-view@"^2.11.0" from react-navigation-tabs@2.7.0 npm ERR! node_modules/react-navigation-tabs npm ERR! react-navigation-tabs@"2.7.0" from the root project npm ERR! peer react-native-gesture-handler@"^1.0.0" from react-navigation-stack@1.10.3 npm ERR! node_modules/react-navigation-stack npm ERR! react-navigation-stack@"^1.7.3" from the root project npm ERR! 1 more (react-navigation-tabs) npm ERR! npm ERR! Could not resolve dependency: npm ERR! @react-native-oh-tpl/react-native-gesture-handler@"2.14.1-2.14.15" from the root project npm ERR! npm ERR! Conflicting peer dependency: react-native-gesture-handler@2.14.1 npm ERR! node_modules/react-native-gesture-handler npm ERR! peer react-native-gesture-handler@"2.14.1" from @react-native-oh-tpl/react-native-gesture-handler@2.14.1-2.14.15 npm ERR! node_modules/@react-native-oh-tpl/react-native-gesture-handler npm ERR! @react-native-oh-tpl/react-native-gesture-handler@"2.14.1-2.14.15" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
最新发布
09-22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值