Reactnative Project Configuration Essentials

Source: Internet
Author: User

This article has a problem, for reference only, complete configuration see:
http://www.jianshu.com/p/7a6639d67783

Today try to run Reactnative's example project, there are a few things to keep in mind when configuring a project.

1. npm installSlow

npm installRunning slowly, unbearable, replacing a cache server can speed up.

npm install -g cnpm --registry=http://registry.npm.taobao.org

Reference: http://blog.csdn.net/spy19881201/article/details/26943051

2. CocoaPods Configuration

Cocoapods is an iOS-developed library management tool that reactnative of course supports.
First create Podfile , add the following code

    ‘React‘    ‘React/RCTText‘    tousein your project

And then run

install

Reference:
Http://wiki.jikexueyuan.com/project/react-native/integration-existing.html
Currently this document translation lacks Android project configuration, Android is already an integral part of Reactnatvie, cross platform is finally possible, Android part reference website.

3. Missing module

When you run the project, the local server reports a missing module error, such as

 module. js: 338throw err; ^Error: cannotFind module 'escape-string-regexp'AtFunction.Module. _resolvefilename ( module. js: 336:15)AtFunction.Module. _load ( module. js: 278:25)AtModule.require( module. js: 365:17)Atrequire( module. js: 384:17)AtObject.<anonymous> (/users/xxxx/dev/githublibrary/react-native/node_modules/chalk/index.JS:2: -) atModule. _compile ( module. js: 460:26)AtObject.Module. _extensions. JS ( module. js: 478:10)AtModule. Load ( module. js: 355:32)AtFunction.Module. _load ( module. js: 310:12)AtModule.require( module. js: 365:17)

Indicates missing module, after running npm install , install module

install escape-string-regexp

I try to run a 2048 example project and need to download very many modules

npm install babel-corepromisegraceful-fsdebugunderscorechalkoptimistyeoman-environmentnode-fetchwordwrapsemverconnectopnabsolute-pathuglify-jsbserjoisaneprogressworker-farmimage-sizefbjs-scriptsws

So boring! I hope the reactnative configuration can improve some later.

4. Naming conflicts

This is relatively simple, you can delete the duplicate files. Error messages such as

Error Building DepdendencyGraph:Error:Naming Collision detected:/users/wangchenlong/exercises/examples/ React-native/libraries/animated/src/easing.js collides with/users/wangchenlong/exercises/examples/react-native/examples/2048/pods/react/libraries/animated/easing.js atHastemap._updateHastemap (/users/wangchenlong/exercises/examples/react-native/packager/react-packager/src/dependencyresolver/ Dependencygraph/hastemap.js:123: -) at/users/wangchenlong/exercises/examples/react-native/packager/react-packager/src/dependencyresolver/ Dependencygraph/hastemap.js: the: -     atTrycallone (/users/wangchenlong/exercises/examples/react-native/node_modules/promise/lib/core.js:Panax Notoginseng: A) at/users/wangchenlong/exercises/examples/react-native/node_modules/promise/lib/core.js:103: the     atFlush (/users/wangchenlong/exercises/examples/react-native/node_modules/promise/node_modules/asap/raw.js: -: in) atDoNTCallback0 (node. JS:417:9) at Process._tickCallback (node. JS:346: -) Process terminated. Press <enter> to Close  theWindow

When the server fails to start, the red screen will be resolved.

OK, these are all mastered and can handle most reactnative projects, but it's cumbersome to configure.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Reactnative Project Configuration Essentials

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.