- node.js下载地址:
- node.js 默认安装位置:C:\Users\xxx\AppData\Roaming 下的npm和npm-cache目录里。这个是隐藏目录。
- 可以使用命令: npm config ls 查看配置内容。
- 创建变更后的目录,使用命令:
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.
-
设置默认镜像源:使用 `npm config set registry` 命令将默认镜像源设置为 `https://registry.npmmirror.com/`。
npm config set registry` https://registry.npmmirror.com/`。
淘宝的镜像源:https://registry.npm.taobao.org,可能近期有问题,一直连不上。
-
其他镜像源地址,如下:
# 淘宝镜像源 https://registry.npmmirror.com # 腾讯云镜像源 http://mirrors.cloud.tencent.com/npm/ # 华为云镜像源 https://mirrors.huaweicloud.com/repository/npm/ # 官方默认全局镜像 https://registry.npmjs.org
-
安装cnpm
npm install -g cnpm --registry=https://mirrors.huaweicloud.com/repository/npm/
-
安装cli
npm update -g @vue/cli
-
创建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)
-
安装element-ui
npm install -g element-ui -S
- 安装webpack 或下载webpack
npm install -g webpack 或 npm remove -g webpack
node.js安装,配置npm更改镜像源。以及Vue安装vue2过程
最新推荐文章于 2024-05-17 13:05:01 发布
本文介绍了如何在Node.js中更改默认的npm安装路径,包括设置npm缓存目录,查看和设置npm配置,以及推荐了一些可用的镜像源。还提到了如何安装和更新VueCLI及ElementUI等项目。
摘要由CSDN通过智能技术生成