npm install不能用是怎么回事 react-react native开发工具 开发

终于可以 npm i -g react-native-cli - CNode技术社区
React Native 正式开源了~~
swift白学了。。
这个牛逼,前端又无敌了
前端跨平台先天性优势啊
React Native compiles apps written in Javascript into native views, providing the platform-specific look and feel on iOS and Android devices that users are accustomed to. This isn’t a web wrapper like you mi it’s real, native code that’s as performant as a fully native app.
Facebook already uses React Native to build some of its main apps: Facebook Groups, for example, uses React Native to render many of its views from React’s Javascript into native code.
The company says that React and React Native allows you to learn a single language and write code for any platform easily and efficiently.
When it announced the library initially, many developers were excited about the ability to write code in React Native and see the results in a few seconds, without re-compiling their entire app.
React Native is available from today, for free on Facebook’s Github page. Android support is not included in this release but is expected to be forthcoming.
感觉这东西比native script靠谱,原理有可能是把xib里xml compile了,然后利用javascript core
CNode 社区为国内最专业的 Node.js 开源技术社区,致力于 Node.js 的技术研究。
服务器赞助商为
,存储赞助商为
,由提供应用性能服务。
新手搭建 Node.js 服务器,推荐使用无需备案的一步一步搭建ReactNative开发环境
1 环境搭建
工欲善其事,必先利其器。首先,我们需要搭建开发环境(我们以后的文章和视频均是以Mac OS X系统为基础)。React Native主要依赖以下环境。
Mac OS X操作系统。
推荐使用Xcode 7.3.0或者更高版本。
安装Node.js v6.2.1或者最新版本。
利用Homebrew安装watchman和flow。
安装React Native
创建第一个HelloWorld程序
下面我们一步步来安装开发环境。
1.1 安装Xcode
打开Mac电脑,打开App Store,在App Store中搜索Xcode,双击Xcode,输入apple id下载安装即可。
1.2& 安装Node.js
Node.js官网:
打开Node.js官网:
下载v6.2.1版本,下载完成以后双击node-v6.2.1.pkg包进行安装。
从上图中中This package will install Node.js v6.2.1 and nam v3.9.3 into /usr/local/.这句话表明我们将会安装Node.js v6.2.1和npm 3.9.3版本.
上图表示Node.js和npm都是安装在/usr/local/bin/路径下面。
1.3 利用Homebrew安装watchman和flow
打开终端,按照如下操作即可.
接下来通过brew安装watchman和flow.
现在万事具备,只欠东风。我们通过npm安装react-native-cli的命令行工具。在mac终端中输入如下命令,其中-g表示全局安装。
1.4 NVM安装
bogon:Desktop lucien$ git clone /creationix/nvm
Cloning into ‘nvm’…
remote: Counting objects: 4718, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 4718 (delta 1), reused 0 (delta 0), pack-reused 4712
Receiving objects: 100% (), 1.26 MiB | 85.00 KiB/s, done.
Resolving deltas: 100% (), done.
Checking connectivity… done.
bogon:Desktop lucien$ cd nvm/
bogon:nvm lucien$ ls
CONTRIBUTING.md README.markdown nvm-exec test
LICENSE.md bash_completion nvm.sh update_test_mocks.sh
Makefile install.sh package.json
bogon:nvm lucien$ source nvm.sh&
bogon:nvm lucien$ nvm
Node Version Manager
Note: &version& refers to any version-like string nvm understands. This includes:
– full or partial version numbers, starting with an optional “v” (0.10, v0.1.2, v1)
– default (built-in) aliases: node, stable, unstable, iojs, system
– custom aliases you define with `nvm alias foo`
nvm –help& & & & & & & & & & & & & & & & Show this message
nvm –version & & & & & & & & & & & & & & Print out the latest released version of nvm
nvm install [-s] &version&& & & & & & & & Download and install a &version&, [-s] from source. Uses .nvmrc if available
–reinstall-packages-from=&version& & & When installing, reinstall packages installed in &node|iojs|node version number&
nvm uninstall &version& & & & & & & & & & Uninstall a version
nvm use [–silent] &version&& & & & & & & Modify PATH to use &version&. Uses .nvmrc if available
nvm exec [–silent] &version& [&command&] Run &command& on &version&. Uses .nvmrc if available
nvm run [–silent] &version& [&args&] & & Run `node` on &version& with &args& as arguments. Uses .nvmrc if available
nvm current & & & & & & & & & & & & & & & Display currently activated version
nvm ls& & & & & & & & & & & & & & & & & & List installed versions
nvm ls &version&& & & & & & & & & & & & & List versions matching a given description
nvm ls-remote & & & & & & & & & & & & & & List remote versions available for install
nvm ls-remote &version& & & & & & & & & & List remote versions available for install, matching a given &version&
nvm version &version& & & & & & & & & & & Resolve the given description to a single local version
nvm version-remote &version&& & & & & & & Resolve the given description to a single remote version
nvm deactivate& & & & & & & & & & & & & & Undo effects of `nvm` on current shell
nvm alias [&pattern&] & & & & & & & & & & Show all aliases beginning with &pattern&
nvm alias &name& &version&& & & & & & & & Set an alias named &name& pointing to &version&
nvm unalias &name&& & & & & & & & & & & & Deletes the alias named &name&
nvm reinstall-packages &version&& & & & & Reinstall global `npm` packages contained in &version& to current version
nvm unload& & & & & & & & & & & & & & & & Unload `nvm` from shell
nvm which [&version&] & & & & & & & & & & Display path to installed node version. Uses .nvmrc if available
nvm install v0.10.32& & & & & & & & & Install a specific version number
nvm use 0.10& & & & & & & & & & & & & Use the latest available 0.10.x release
nvm run 0.10.32 app.js& & & & & & & & Run app.js using node v0.10.32
nvm exec 0.10.32 node app.js& & & & & Run `node app.js` with the PATH pointing to node v0.10.32
nvm alias default 0.10.32 & & & & & & Set default node version on a shell
to remove, delete, or uninstall nvm – just remove the `$NVM_DIR` folder (usually `~/.nvm`)
bogon:nvm lucien$ nvm ls -remote
bogon:nvm lucien$ nvm ls
-& & & & v6.2.1
default -& node (-& v6.2.1)
node -& stable (-& v6.2.1) (default)
stable -& 6.2 (-& v6.2.1) (default)
iojs -& N/A (default)
bogon:nvm lucien$
1.5& 创建项目
搭建好RN环境以后,我们来创建一个HelloWorld项目。见终端。
1.6 运行项目
Command + R运行
接下来关闭Xcode,注意:不要关闭终端和模拟器,用Sublime打开index.ios.js,编辑,保存,选中模拟器,重新按Command+R运行即可,无需重新打开Xcode运行。
关注下,有惊喜!微信搜索公众号:meitianyixi
扫一扫有惊喜ReactNative(一)—— Android环境搭建以及注意事项
ReactNative(一)—— Android环境搭建以及注意事项
ReactNative
在之前没想过要写学习笔记的,不过今天想把webstorm的配置分享出来,然后还是想想还是把学习的记录给写下来吧。不过这就尴尬了,之前写的博客就需要重新排列一下顺序了。也不管了,就写吧。不过记录肯定要从零开始了,在什么都没有的基础上慢慢来看看怎么搭建环境吧!
在ReactNative(以下简称RN)中文网上有详细的教程,我在这里的话只主要把重要的部分给记录下来吧,包括工具的链接等。
工具:Android Studio + WebStorm + Android 模拟器 + Git等。
语言:ReactNative。
工具网站传送门
RN中文网:
工具网站:
Android SDK 和 Android Studio: 近日发现google官网已不再提供单独的SDK管理工具包的下载,只能通过下载AndroidStudio来使用SDK Manager。
科学上网的打开方式:
或者移步到中文网: 也可以下载。
WebStorm官网:
nodejs官网:
Git版本管理工具:
SDK的下载及编译工具版本选择
目前官网推荐下载的几个内容如下:
!!!Android SDK Build-tools的版本一定要为23.0.1,23.0.1,23.0.1,23.0.1,这是官方推荐的!重要的事情要说三遍,以上!!!
SDK Platform版本:
SDK Platform推荐装以下几个版本:Android N 、6.0 、5.1.1、5.0.1、4.4.2、4.1.2,原因是这几个版本个人认为跨度比较大,API方面的差异在更高的版本上会增加很多4.1.2为RN支持的最低版本。
Android模拟器镜像:
主要是6.0、5.1和4.1的版本,调试的时候如果用到模拟器的话就需要,所以主要推荐这三个,当然你不嫌麻烦也可以下载更多的版本体验调试。
说一下,我这里是因为电脑支持x86的模拟器内核,x86是一种加速内核,稍微比其他两个流畅一些,所以就只下载了这个,如果你的电脑不支持x86内核的话,就要下载ARM或者MIPS,具体看情况。
通过nodejs安装RN工具包
在完成nodejs的安装后,就可以在命令行使用npm指令了。
首先安装npm的源管理器nrm:
npm install -g nrm
看到类似这样的就是安装成功了,我这是已经安装过的相当于版本更新,所以结果可能稍微不同。
赶紧看看是否安装成功:
如果在这里没有这样显示或者报其他的错,那就重新安装nrm。
切换到taobao源上:
nrm use taobao
切换到taobao源的目的是为了使用npm指令安装其他插件的时候能使用国内的源下载,否则会因为国外的源跟我们的距离关系,有时候会一直卡着。
更新npm自身插件:
npm install -g npm
会将当前的npm版本更新为最新版。
安装react-native工具包:
npm install -g react-native-cli
通过nodejs的安装可以使用npm命令=&使用npm安装更多的插件(如:nrm,react-native-cli)。
安装/更新xxx插件:
npm install -g xxx
卸载xxx插件:
npm uninstall xxx
查看react-native-cli插件版本:
react-native --v
查看npm版本:
感谢你耐心的看完这篇文章!
惊喜总是在最后!
推荐免费科学上网工具(非广告):
WebStorm免费30天不够用?
工具下载地址:
链接: 密码:ci6z
以上方法仅供DS参考,还请支持正版!
我的热门文章
即使是一小步也想与你分享

我要回帖

更多关于 npm react native 的文章

 

随机推荐