2017-04-17 82 views
0

我可能讀了這個問題超過了幾個小時,我找不到任何有用的東西。 我很新的反應母語和我之前安裝了這個包,一切都很好: 反應母語 - 彈出式對話框react-native不生成android的文件

在那之後,我開始的錯誤,然後,我用刪除的包npm卸載命令。錯誤提示:

To resolve try the following: 
    1. Clear watchman watches: `watchman watch-del-all`. 
    2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`. 
    3. Reset packager cache: `rm -fr $TMPDIR/react-*` or `npm start -- --reset-cache`. 

嗯,我做了這個,現在我不能讓項目再次工作。我得到這個錯誤:

Loading dependency graph, done. 
Bundling `index.android.js` 
    Transforming modules ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░ 86.0% (575/620)...(node:12608) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1626): UnableToResolveError: Unable to resolve module react-native/Libraries/Components/StaticContainer.react from D:\Code\Mobile\node_modules\native-base\dist\src\basic\Tabs\SceneComponent.js: Module does not exist in the module map or in these directories: 
    D:\Code\Mobile\node_modules\react-native\Libraries\Components 

This might be related to https://github.com/facebook/react-native/issues/4968 
To resolve try the following: 
    1. Clear watchman watches: `watchman watch-del-all`. 
    2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`. 
    3. Reset packager cache: `rm -fr $TMPDIR/react-*` or `npm start -- --reset-cache`. 
(node:12608) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process Bundling `index.android.js` 

我都懂沒有找到模塊StaticContainer.react,但我並沒有取得在本土基地東西。我再次嘗試刪除node_modules和clean-cache,但沒有奏效。

我的package.json是:

{ 
    "name": "MyProject", 
    "version": "0.0.1", 
    "private": true, 
    "scripts": { 
    "start": "node node_modules/react-native/local-cli/cli.js start", 
    "test": "jest" 
    }, 
    "dependencies": { 
    "native-base": "^2.0.10", 
    "react": "15.4.2", 
    "react-native": "0.43.0", 
    "react-native-fcm": "^6.2.0", 
    "react-native-localization": "^0.1.29", 
    "react-native-popup-dialog": "^0.7.22", 
    "react-native-tabs": "^1.0.9", 
    "react-native-vector-icons": "^4.0.0", 
    "react-navigation": "^1.0.0-beta.6" 
    }, 
    "devDependencies": { 
    "babel-jest": "19.0.0", 
    "babel-preset-react-native": "1.9.1", 
    "jest": "19.0.2", 
    "react-test-renderer": "15.4.2" 
    }, 
    "jest": { 
    "preset": "react-native" 
    } 
} 

有人能幫助我嗎?

感謝, 若昂

回答

0

本土基隊改變了依賴來自: "react": "^15.4.2""react": "^16.0.0-alpha.3""react-native": "^0.39.2""react-native": "^0.43.0"

當您進行重新安裝原生基rm -rf node_modules && npm install它可能安裝較新代碼庫與上述變化。

因此,無論您更新到新版本,或者如果你不能因爲擔心其他依賴升級,手動更改的模塊文件夾:

打開SceneComponent.js~/node_modules/native-base/dist/src/basic/Tabs/

和變更線從6

var StaticContainer=require('react-native/Libraries/Components/StaticContainer.react');

var StaticContainer=require('react-native/Libraries/Components/StaticContainer');

不要忘了執行npm start -- --reset-cache

+0

尼斯,我做出了正確的更新和工作就像一個魅力。感謝您的解釋! –

+0

不客氣。請記住,第二個選項只是一個快速修復。最終,您需要逐個更新所有庫。 ;-) –