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

Created on 12 Feb 2018  ·  15Comments  ·  Source: ant-design/ant-design-pro

初始化项目后,在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

> [email protected] install D:\antpro-demo\node_modules\husky
> node ./bin/install.js

husky
setting up Git hooks
done


> [email protected] 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

                    ***


> [email protected] postinstall D:\antpro-demo\node_modules\uglifyjs-webpack-plugin
> node lib/post_install.js


> [email protected] postinstall D:\antpro-demo\node_modules\electron
> node install.js

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

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

> [email protected] 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.

Most helpful comment

@everyone Fixed in [email protected], try reinstall node_modules.

All 15 comments

在macOS下更新 package.json 后也出现相同情况

same here

Same here, on windows.

Linux下, 也是一样.

Mac下面直接新建项目启动也报一样的错误

Mac, node 8.9.4, 同样的问题。

itcan be fixed in this way:
change import { LocaleProvider, Spin } from 'antd'; to import LocaleProvider from 'antd/lib/locale-provider' import Spin from 'antd/lib/spin'

same problem

@sorrycc 发现 babel 编译后 import { LocaleProvider, Spin } from 'antd'; 被移除了,是不是有相关的改动?

Not only LocaleProvider is not defined, all the libs that imported from antd are not defined.
If you remove the reference of LocaleProvider, same problem will be throwed:

ReferenceError: Icon is not defined

我的也是一样,更新了最新的包就出错了

同样的问题 git clone 、download ZIP 、 pro new都试过了

The same problem for me. node version: 9.4.0, os version: Ubuntu 16.04

the same problem i have met. node version: 8.9.4, Ubuntu 16.04

@everyone Fixed in [email protected], try reinstall node_modules.

Was this page helpful?
0 / 5 - 0 ratings