node.js安装,配置npm更改镜像源。以及Vue安装vue2过程

  1. node.js下载地址:
  2. node.js 默认安装位置:C:\Users\xxx\AppData\Roaming 下的npm和npm-cache目录里。这个是隐藏目录。
  3. 可以使用命令: npm config ls 查看配置内容。
  4. 创建变更后的目录,使用命令: 
    npm config set cache “D:\xxx\npm-cache”
    npm config set prefix “D:\xxx\npm”
    D:\nodejs\repository\npm>npm config ls
    ; "builtin" config from D:\nodejs\node_modules\npm\npmrc
    
    ; prefix = "C:\\Users\\xxx\\AppData\\Roaming\\npm" ; overridden by user
    
    ; "user" config from D:\Git\repository\git_config\.npmrc
    
    cache = "D:\\nodejs\\repository\\npm-cache"
    prefix = "D:\\nodejs\\repository\\npm"
    registry = "https://registry.npmmirror.com"
    
    ; node bin location = D:\nodejs\node.exe
    ; node version = v20.11.0
    ; npm local prefix = D:\nodejs\repository\npm
    ; npm version = 10.2.4
    ; cwd = D:\nodejs\repository\npm
    ; HOME = D:\Git\repository\git_config
    ; Run `npm config ls -l` to show all defaults.

  5. 设置默认镜像源:使用 `npm config set registry` 命令将默认镜像源设置为 `https://registry.npmmirror.com/`。

    npm config set registry` https://registry.npmmirror.com/`。

    淘宝的镜像源:https://registry.npm.taobao.org,可能近期有问题,一直连不上。

  6. 其他镜像源地址,如下:

    # 淘宝镜像源
    https://registry.npmmirror.com
    # 腾讯云镜像源
    http://mirrors.cloud.tencent.com/npm/
    # 华为云镜像源
    https://mirrors.huaweicloud.com/repository/npm/
    # 官方默认全局镜像
    https://registry.npmjs.org

  7. 安装cnpm 

    npm install -g cnpm --registry=https://mirrors.huaweicloud.com/repository/npm/

  8. 安装cli

    npm update -g @vue/cli
    

  9. 创建vue,安装vue2

    vue create vue
    
    D:\nodejs\repository\npm>vue create vue
    
    
    Vue CLI v5.0.8
    Failed to check for updates
    ? Target directory D:\nodejs\repository\npm\vue already exists. Pick an action: (Use arrow keys)
    > Overwrite
      Merge
      Cancel

    选择>Overwrite

    Vue CLI v5.0.8
    Failed to check for updates
    ? Please pick a preset:
      Default ([Vue 3] babel, eslint)
    > Default ([Vue 2] babel, eslint)
      Manually select features

    选择> Default ([Vue 2] babel, eslint)

  10. 安装element-ui

    npm install -g element-ui -S
  11. 安装webpack 或下载webpack
    npm install -g webpack
    或
    npm remove -g webpack


     

     

  • 6
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值