close

不知道大家有沒有承接別人 React Native 專案的經驗
這次的問題發生在我從 svn 下拉同事 RN 的專案時
想要 run 的時候發生問題
完整錯誤訊息如下:
Unable to resolve module `react-native-scrollable-tab-view` from `/Users/80005455/Desktop/ResourceCode/SFA3_2.0_RN_Willy/js/view/CarLoadingComponent.js`: Module does not exist in the module map or in these directories:/Users/80005455/Desktop/ResourceCode/SFA3_2.0_RN_Willy/node_modules

 

這問題是因為我的 CarloadingComponent.js 中
有用到 `react-native-scrollable-tab-view` 這個 module
但這個 module 卻不在我們的 node_modules 裡面
所以才報出這個錯誤

 

有關 node_modules 這個資料夾
我們都知道這個是自動生成的
當我們輸入指令 npm install 之後會生成
那裡面缺了東西怎麼辦呢?

 

現在讓我們翻翻 RN 專案的資料夾吧
是不是有看到一個 package.json 呢?

 

其實當生成 node_mudules 的時候就是參考這份文件
只要我們在 dependencies 中加入 "react-native-scrollable-tab-view": "^0.6.6"
那麼我們生成 node_mudules  的時候
這個 module 就會自動的被加在裡面了喔




 


arrow
arrow
    全站熱搜

    顏澤偉 發表在 痞客邦 留言(0) 人氣()