React Native項目從0.28升級到0.29 (iOS)

React Native項目從0.28升級到0.29 (iOS)


備忘紀要:


1.升級react-native到0.29.0版本 

方法一:

到項目跟目錄下,cmd運行命令: react-native-git-upgrade 0.29.0,運行完畢後,應該沒有ERROR類型的消息,會有一些提示信息:需要修改等等,表示react-native升級成功。

參考文章:http://blog.csdn.net/jiangbo_phd/article/details/54693335

方法二:

用 react-nativve-git-upgrade 0.29.0升級失敗的情況下,手動升級,方法如下:


Alternative

Use this only in case the above didn't work.

1. Upgrade the react-native dependency

Note the latest version of the react-native npm package from here (or use npm info react-native to check).

Now install that version of react-native in your project with npm install --save:

$ npm install --save [email protected]
# where X.Y is the semantic version you are upgrading to
npm WARN peerDependencies The peer dependency react@~R included from react-native...

If you saw a warning about the peerDependency, also upgrade react by running:

$ npm install --save react@R
# where R is the new version of react from the peerDependency warning you saw

2. Upgrade your project templates(慎用react-native upgrade,如果不熟悉iOS開發,最好是不要執行這一步,只執行第一步既可以:npm install --save [email protected]

The new npm package may contain updates to the files that are normally generated when you run react-native init, like the iOS and the Android sub-projects.

You may consult rn-diff to see if there were changes in the project template files. In case there weren't any, simply rebuild the project and continue developing. In case of minor changes, you may update your project manually and rebuild.

If there were major changes, run this in a terminal to get these:

$ react-native upgrade

This will check your files against the latest template and perform the following:

  • If there is a new file in the template, it is simply created.
  • If a file in the template is identical to your file, it is skipped.
  • If a file is different in your project than the template, you will be prompted; you have options to keep your file or overwrite it with the template version.


2.  沒有使用react-native upgrade命令,這個命令會修改相關模板文件,導致原項目中很多地方需要修改,本次升級並沒有使用

慎用react-native upgrade,如果不熟悉iOS開發,最好是不要執行這一步,只執行第一步既可以:npm install --save [email protected]


3. 鏈接項目RCTWebSocket.m文件編譯時,會提示沒有處理返回值,按照下面截圖的方式處理;

如果有其他項目編譯出錯,則按照提示進行修改




4. 注意:命令執行完畢後,會自動把之前的某些第三方的插件刪除(node_modules目錄下),具體原因未知,從原來的備份的文件中將丟失的模塊拷貝到升級後的項目中既可。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章