从零搭建一个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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容