npm install --save react react-dom babelify babel-preset-react
npm install -g webpack (全局安装)
npm install -g webpack-dev-server (安装webpack-dev-server)
npm install webpack --save (安装到项目目录)
npm install webpack-dev-server --save
webpack-dev-server --contentbase src --inline --hot(热加载,自动刷新)
npm install webpack-cli --save-dev (单独安装webpack-cli)
npm start (执行命令) npm run build
npm run server (在本地的8080端口查看结果)
npm install --save-dev babel-core babel-loader babel-preset-env babel-preset-react(安装Babel依赖包,编译使用)
(npm一次性安装多个依赖模块,模块之间用空格隔开)
npm install --save-dev webpack-dev-server (构建本地服务器)
npm run server(运行本地服务器)
npm install --save-dev style-loader css-loader (安装解析css模块)
npm install --save-dev babel-plugin-react-transform react-transform-hmr (辅助热加载)
npm install --save prop-types (安装prop-types,16.x版本需要单独安装才可以使用)
npm install react-responsive fetch --save(响应式,请求接口用到的)
npm install -g create-react-app 脚手架
create-react-app my-app
cd my-app/
npm start
cnpm install(自动安装所有package表里插件)