ant-design-pro: ReferenceError: LocaleProvider is not defined

初始化项目后,在MAC电脑上可以正常访问,当我在Windows电脑上git clone,npm install, npm start后,报如下错误,备注:在VScode中能找到LocaleProvider的源码。

ReferenceError: LocaleProvider is not defined
RouterConfig
D:/antpro-demo/src/router.js:23
  20 | var routerData = getRouterData(app);
  21 | var UserLayout = routerData['/user'].component;
  22 | var BasicLayout = routerData['/'].component;
> 23 | return React.createElement(LocaleProvider, {
  24 |   locale: zhCN
  25 | }, React.createElement(ConnectedRouter, {
  26 |   history: history
View compiled
▶ 22 stack frames were collapsed.
(anonymous function)
D:/antpro-demo/src/index.js:81
  78 | })(); // 5. Start
  79 | 
  80 | 
> 81 | app.start('#root');
  82 | FastClick.attach(document.body);
  83 | export default app._store; // eslint-disable-line
  84 | 

其中node版本v8.9.4,npm版本5.6.0,具体命令输出如下:

PS D:\antpro-demo> npm install

> husky@0.14.3 install D:\antpro-demo\node_modules\husky
> node ./bin/install.js

husky
setting up Git hooks
done


> react-slick@0.17.1 postinstall D:\antpro-demo\node_modules\react-slick
> opencollective postinstall


     *** Thank you for using react-slick! ***

Please consider donating to our open collective
     to help us maintain this package.

  https://opencollective.com/react-slick/donate

                    ***


> uglifyjs-webpack-plugin@0.4.6 postinstall D:\antpro-demo\node_modules\uglifyjs-webpack-plugin
> node lib/post_install.js


> electron@1.8.2 postinstall D:\antpro-demo\node_modules\electron
> node install.js

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 2170 packages in 70.461s
PS D:\antpro-demo> npm start

> ant-design-pro@1.1.0 start D:\antpro-demo
> cross-env DISABLE_ESLINT=true roadhog dev
Starting the development server...

[babel-plugin-dva-hmr][INFO] got routerPath ./router
Compiled successfully!

You can now view Your App in the browser.

  Local:            http://localhost:8000/
  On Your Network:  http://192.168.2.8:8000/

Note that the development build is not optimized.
To create a production build, use npm run build.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (2 by maintainers)

Most upvoted comments

@everyone Fixed in babel-plugin-import@1.6.4, try reinstall node_modules.