1.安裝指定版本插件命令html
npm install 插件名字@1.1.4(版本號) --save 或 yarn add 插件名字@1.1.4(版本號) --devreact
2.Error:‘Link’ is not exported from 'react-route'webpack
解決:‘react-router’4.0*以後的版本能夠引用‘react-router-dom’代替‘react-router’web
3.關於react-router中<Link>的調試 Error : You should not use <Link> outside a <Router>npm
解決方法:在Link外加一層<BrowserRouter></BrowserRouter>babel
4.Error: Plugin/Preset files are not allowed to export objects,webpack報錯/babel報錯的解決方法react-router
解決方法: babel版本不統一,把babel全部插件統一改爲6.0或7.0版本便可app
5.Module build faild:TypeError: fileSystem.statSync is not a functiondom
解決方法:babel-loader是7.0版本而webpack是1.15.0版本,兩者不兼容,把babel-loader改爲6.4.1版本ide
6. Uncaught TypeError : Cannot read property 'uniquekey' of undefined(這個問題困擾了我好幾天好氣!!!)
react-router4.*以上版本對2.*版本中的 this.props.params.uniquekey用法作了改動,改爲this.props.match.params.uniquekey問題就解決了!!!
7. Error: Webpack has been initialised using a configuration object that does not match the API schema.- configuration.module has an unknown property 'loaders'. These properties are valid:object { defaultRules?, exprContextCritical?, exprContextRecursive?, exprContextRegExp?, exprContextRequest?, noParse?, rules?, strictExportPresence?, strictThisContextOnImports?, unknownContextCritical?, unknownContextRecursive?, unknownContextRegExp?, unknownContextRequest?, unsafeCache?, wrapped ContextCritical?, wrappedContextRecursive?, wrappedContextRegExp? } -> Options affecting the normal modules (`NormalModuleFactory`).
解決方法:webpack.config.js文件裏的 module{loaders:[......]} 改成 module{rules:[......]}
8. React-router版本5.0.0,移動端開發<Link>頁面跳轉時url會發生變化,可是頁面不跳轉,手動刷新頁面纔會正常跳轉
解決方法:<link>標籤裏沒有target=「_blank」屬性時,Link標籤外要用<Route>包裹而不是<BrowserRouter>
9. React-router 4.*以上版本route文件中,一個<BrowserRouter>下只能有一個Route,若是想放多個須要在<Route>外總體加<Switch>,代碼示例以下
<BrowserRouter > <Switch> <Route exact path="/" component={PCIndex}></Route> <Route path="/details/:uniquekey" component={PCNewsDetails}></Route> <Route path="/usercenter" component={PCUserCenter}></Route> </Switch> </BrowserRouter>