使用gulp打包

  1. 安装cnpm

    npm install -g cnpm --registry=https://registry.npm.taobao.org	
    
  2. 更换镜像

    //更换
    npm config set registry "http://registry.npm.taobao.org/"
    //查看
    npm config get registry
    
  3. 在项目下安装cnpm的node_modules

    cnpm install
    //使用npm install安装,很多东西需要手动安装,cnpm可以关联安装
    
  4. 安装bower

    //安装全局bower
    npm install -g bower
    //在项目路径下使用该命令,安装bower前端仓库(bootstrap等)
    bower install
    
  5. 安装gulp

    (1)安装gulp要做以下准备,安装python2.7
    (2)安装vs2015
    (3)npm config set msvs_version 2015
    注:在使用cnpm安装时,会自带安装这些依赖
    
  6. node-gyp出现

    Can’t find Python executable “python”, you can set the PYTHON env variable.

    按步骤执行

    (1)npm install --global --production windows-build-tools
    (2)Install Visual C++ Build Environment: Visual Studio Build Tools (using "Visual C++ build tools" workload) or Visual Studio 2017 Community (using the "Desktop development with C++" workload)
    (3)npm config set msvs_version 2017
    (4)node-gyp --python /path/to/python2.7或npm config set python D:\python2.7\python.exe
    
  7. nodejs npm 问题解决记录 MSBUILD : error MSB4132: 无法识别工具版本“2.0”。可用的工具版本为 “4.0”

    npm config set msvs_version 2017
    
  8. npm ERR! errno: -4048,npm ERR! code: ‘EPERM’,npm ERR! syscall: ‘lstat’,

    删除npmrc文件,删除C:\Users\Administrator.npmrc文件 
    
  9. npm run和gulp build

    gulp buil用来打包
    npm run用来执行task
    

猜你喜欢

转载自blog.csdn.net/qq_35275077/article/details/89669008
今日推荐