vue或则react项目

1.Nodejs安装及环境配置

参考文章:

https://www.jianshu.com/p/13f45e24b1de

2.vue或则react项目搭建步骤

  • 全局安装vue-cli 命令:npm install --global vue-cli
  • 创建一个基于webpack模板的新项目 vue init webpack my-project
  • 安装依赖 cd my-project
    npm install (换源安装: npm install --registry https://registry.npm.taobao.org )

      如果这个过程中报错,类似这种:vue webpack 启动报错checking for Python executable "python2" in the PATH

      解决办法:

      使用cnpm 来安装:
      具体做法:

  1. 安装cnpm

      npm install cnpm -g --registry=https://registry.npm.taobao.org

     之后使用cnpm,如果报错:'cnpm' 不是内部或外部命令,也不是可运行的程序 或批处理文文件 问题解决

     问题所在cnpm文件夹与npm文件夹不在同一文件夹下
    cnpm所在文件夹:D:\Program Files\nodejs\node_global\node_modules
    npm所在文件:D:\Program Files\nodejs\node_modules

    将cnpm文件夹移动至npm所在的文件夹下,再将cnpm和cnpm.cmd文件移至npm与npm.cmd所在的文件夹即可解决问题

    vue或则react项目

vue或则react项目

  • 启动 npm run dev或者 npm start

    如果启动报错:

 Errors:
         1.http://eslint.org/docs/rules/eol-last    表示:文档末尾要换行;

       Errors:
         2  http://eslint.org/docs/rules/spaced-comment   表示: // 注释后要跟空格。

      Errors:
         3  http://eslint.org/docs/rules/indent    表示:缩进错误,设置'indent':0,

      Errors:
         4  http://eslint.org/docs/rules/no-tabs    表示:tab缩进错误

   报错原因

       文件编码的代码,不符合eslint的语法校验规则

  • 打包 npm run build