搭建react antd

npm install -g antd

npm WARN antd@3.10.8 requires a peer of react@>=16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN antd@3.10.8 requires a peer of react-dom@>=16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ant-design/icons-react@1.1.2 requires a peer of react@16.x but none is installed. You must install peer dependencies yourself.
npm WARN create-react-context@0.2.3 requires a peer of react@^0.14.0 || ^15.0.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN rc-editor-mention@1.1.11 requires a peer of react@>=15.x but none is installed. You must install peer dependencies yourself.
npm WARN rc-editor-mention@1.1.11 requires a peer of react-dom@>=15.x but none is installed. You must install peer dependencies yourself.
npm WARN rc-switch@1.8.0 requires a peer of react@^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN rc-switch@1.8.0 requires a peer of react-dom@^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-slick@0.23.2 requires a peer of react@^0.14.0 || ^15.0.1 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-slick@0.23.2 requires a peer of react-dom@^0.14.0 || ^15.0.1 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-lazy-load@3.0.13 requires a peer of react@^0.14.0 || ^15.0.0-0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-lazy-load@3.0.13 requires a peer of react-dom@^0.14.0 || ^15.0.0-0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN draft-js@0.10.5 requires a peer of react@^0.14.0 || ^15.0.0-rc || ^16.0.0-rc || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN draft-js@0.10.5 requires a peer of react-dom@^0.14.0 || ^15.0.0-rc || ^16.0.0-rc || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN rc-hammerjs@0.6.9 requires a peer of react@^0.14.3 || ^15.0.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.

+ antd@3.10.8
added 115 packages in 60.12s

查看react 版本
npm info react

先安装
npm install react-native -g

npm install --save react@16.3.1
npm install -g react-dom

npm WARN react-dom@16.6.3 requires a peer of react@^16.6.3 but none is installed. You must install peer dependencies yourself.

npm install --save react@16.6.3

npm WARN react-dom@16.6.3 requires a peer of react@^16.6.3 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ react@16.3.1
added 7 packages and updated 1 package in 179.662s

未安装成功

引入 Can't resolve 'antd/dist/antd.css 报错
Can't resolve 'antd/lib/button' 

App.js

import React, { Component } from 'react';
import logo from './logo.svg';
import Button from 'antd/lib/button';
// import { Button } from 'antd';
import 'antd/dist/antd.css';
import './App.css';


// class App extends Component {
//   render() {
//     return (
//       <div className="App">
//         <Button type="primary">Button</Button>
//       </div>
//     );
//   }
// }



class App extends Component {
  render() {
    return (
      <div className="App">
       <div className="App">
         <Button type="primary">Button</Button>
       </div>


        <header className="App-header">
          <img src={logo} className="App-logo" alt="logo" />
          <p>
            Edit <code>src/App.js</code> and save to reload.
          </p>
          <a
            className="App-link"
            href="https://reactjs.org"
            target="_blank"
            rel="noopener noreferrer"
          >
            Learn React
          </a>
        </header>
      </div>
    );
  }
}

export default App;
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值