2017-05-29 111 views
0

我從package.json文件中刪除了一些未使用的依賴關係,然後我做了rm -rf node_modules,然後npm install無法讀取未定義的屬性「風格」React Native

如果我現在建我的項目在Xcode我沒有得到任何錯誤,但如果我嘗試喲在模擬器上運行它,我得到紅屏如下:

enter image description here

在模擬器我得到:

TypeError: Cannot read property 'Symbol(Symbol.iterator)' of null 
    at launchEditor (/Users/boris/Projects/autralis-seller/AutralisSeller/node_modules/react-native/local-cli/server/util/launchEditor.js:153:29) 
    at Object.handle (/Users/boris/Projects/autralis-seller/AutralisSeller/node_modules/react-native/local-cli/server/middleware/openStackFrameInEditorMiddleware.js:17:7) 
    at next (/Users/boris/Projects/autralis-seller/AutralisSeller/node_modules/connect/lib/proto.js:174:15) 
    at Object.handle (/Users/boris/Projects/autralis-seller/AutralisSeller/node_modules/react-native/local-cli/server/middleware/getDevToolsMiddleware.js:74:7) 
    at next (/Users/boris/Projects/autralis-seller/AutralisSeller/node_modules/connect/lib/proto.js:174:15) 
    at Object.handle (/Users/boris/Projects/autralis-seller/AutralisSeller/node_modules/react-native/local-cli/server/middleware/getDevToolsMiddleware.js:74:7) 
    at next (/Users/boris/Projects/autralis-seller/AutralisSeller/node_modules/connect/lib/proto.js:174:15) 
    at Object.compression [as handle] (/Users/boris/Projects/autralis-seller/AutralisSeller/node_modules/compression/index.js:205:5) 
    at next (/Users/boris/Projects/autralis-seller/AutralisSeller/node_modules/connect/lib/proto.js:174:15) 
    at IncomingMessage.<anonymous> (/Users/boris/Projects/autralis-seller/AutralisSeller/node_modules/react-native/local-cli/server/middleware/loadRawBodyMiddleware.js:20:5) 

我不知道發生了什麼事。任何想法如何解決它?

編輯

Scene.js是從反應本地路由器通量導航:

/** 
* Copyright (c) 2015-present, Pavel Aksonov 
* All rights reserved. 
* 
* This source code is licensed under the BSD-style license found in the 
* LICENSE file in the root directory of this source tree. 
* 
*/ 
import React, { PropTypes } from 'react'; 
import { ViewPropTypes, Text } from 'react-native'; 

export default class extends React.Component { 

    // @todo - should all props be documented/specified here? 

    static propTypes = { 
    tabBarStyle: ViewPropTypes.style, 
    tabBarSelectedItemStyle: ViewPropTypes.style, 
    tabBarIconContainerStyle: ViewPropTypes.style, 
    tabBarShadowStyle: ViewPropTypes.style, 
    tabSceneStyle: ViewPropTypes.style, 
    tabStyle: ViewPropTypes.style, 
    tabTitleStyle: Text.propTypes.style, 
    tabSelectedTitleStyle: Text.propTypes.style, 
    tabTitle: PropTypes.string, 
    }; 

    render() { 
    return null; 
    } 
} 
+1

什麼是線30 Scene.js的源代碼? –

+0

@BrunoGrieder我更新了我的問題。那是從'react-native router-flux'導航 – Boky

+0

你可以發佈包含/調用你的項目場景的代碼嗎? –

回答

1

所以我有這個問題,以及和您的文章幫我解決這個問題。 React本地路由器Flux大約在2周前更新,其中View.propTypes已被棄用於新的ViewPropTypes。這是對它的承諾。 https://github.com/aksonov/react-native-router-flux/commit/36dc20418987850677c52905beda59310a0500c3

問題是,當這個更新被提交給實時分支時,庫版本並沒有從3.37.0增加,所以如果你在實現該提交之後完成了npm安裝,你的軟件包將用新的更改進行更新,但你很可能對他們所做的都不是很明智(除非你閱讀你在項目中使用的每個包的提交更新)

我發現將react-native-router-flux恢復到較早的版本解決了這個問題。我用3.36.0

NPM安裝[email protected] --save

+0

+1我下載的教程是使用react路由器v3.37.0並給出了這個錯誤。我把你的建議剝離回v3.36.0,並在此之後完美運行。謝謝 – 4UmNinja

相關問題