从零搭建一个React/Vue项目

Prepare node.js,npm & webpack

  1. check
    whether you have installed node.js on this computer and which version
node -v
npm -v
  1. install
    download node.js from https://nodejs.org/en/, npm is included in.
  2. set CLASSPATH
    如果之前安装过,会有之前的环境变量设置,检查下是否一致,会影响到后面的webpack全局安装。
  3. install webpack
npm install webpack -g

Create React App

npm install -g create-react-app
create-react-app hello-world
cd hello-world
npm run start

Create Vue-Cli

npm install -g vue-cli
vue init webpack projectname
?Install vue-router? Yes
? Use ESLint to lint your code? No
? Setup unit tests with Karma + Mocha? Yes
? Setup e2e tests with Nightwatch? Yes
cd projectname
npm install
npm run dev

你可能感兴趣的:(从零搭建一个React/Vue项目)