-
双击安装,指定d盘

-
参考
-
查看文件夹

-
查看环境变量,自动添加如下
| C:\Users\dogle>node -v |
| v18.14.2 |
| |
| C:\Users\dogle>npm -v |
| 9.5.0 |
| |
| C:\Users\dogle>echo %PATH% |
| C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;D:\software\Git\cmd;D:\Windows Kits\10\Windows Performance Toolkit\;D:\software\Anaconda3;D:\software\Anaconda3\Scripts;D:\software\Anaconda3\Library\bin;D:\software\Java\jdk-1.8\bin;D:\software\nodejs\;C:\Users\dogle\AppData\Local\Microsoft\WindowsApps;D:\software\Microsoft VS Code\bin;C:\Users\dogle\AppData\Local\Programs\EmEditor;C:\Users\dogle\AppData\Roaming\npm |
-
进入如下目录

-
移动到nodejs安装目录并修改名称

-
打开cmd执行如下命令
| C:\Users\dogle>npm config set prefix "D:\software\nodejs\node_global" |
| |
| C:\Users\dogle>npm config set cache "D:\software\nodejs\node_cache" |
| C:\Users\dogle>npm prefix -g |
| D:\software\nodejs\node_global |
| |
| C:\Users\dogle>npm list -global |
| D:\software\nodejs\node_global |
| `-- (empty) |
| # 镜像站 |
| C:\Users\dogle>npm config set registry=http: |
| |
| # 查看镜像信息 |
| C:\Users\dogle>npm config get registry |
| http: |
| |
| # 查看所有配置信息 |
| C:\Users\dogle>npm config list |
| ; "builtin" config from D:\software\nodejs\node_modules\npm\npmrc |
| |
| ; prefix = "C:\\Users\\dogle\\AppData\\Roaming\\npm" ; overridden by user |
| |
| ; "user" config from C:\Users\dogle\.npmrc |
| |
| cache = "D:\\software\\nodejs\\node_cache" |
| prefix = "D:\\software\\nodejs\\node_global" |
| registry = "http://registry.npm.taobao.org/" |
| |
| ; node bin location = D:\software\nodejs\node.exe |
| ; node version = v18.14.2 |
| ; npm local prefix = C:\Users\dogle |
| ; npm version = 9.5.0 |
| ; cwd = C:\Users\dogle |
| ; HOME = C:\Users\dogle |
| ; Run `npm config ls -l` to show all defaults. |
| |
| # 查看所有配置信息 |
| C:\Users\dogle>npm config ls |
| ; "builtin" config from D:\software\nodejs\node_modules\npm\npmrc |
| |
| ; prefix = "C:\\Users\\dogle\\AppData\\Roaming\\npm" ; overridden by user |
| |
| ; "user" config from C:\Users\dogle\.npmrc |
| |
| cache = "D:\\software\\nodejs\\node_cache" |
| prefix = "D:\\software\\nodejs\\node_global" |
| registry = "http://registry.npm.taobao.org/" |
| |
| ; node bin location = D:\software\nodejs\node.exe |
| ; node version = v18.14.2 |
| ; npm local prefix = C:\Users\dogle |
| ; npm version = 9.5.0 |
| ; cwd = C:\Users\dogle |
| ; HOME = C:\Users\dogle |
| ; Run `npm config ls -l` to show all defaults. |
| |
| # 查看C:\Users\dogle\.npmrc |
| registry=http: |
| prefix=D:\software\nodejs\node_global |
| cache=D:\software\nodejs\node_cache |
| NODE_PATH=D:\software\nodejs\node_global\node_modules |
| C:\Windows\System32>npm install vue -g |
| |
| added 20 packages in 2s |
| |
| 3 packages are looking for funding |
| run `npm fund` for details |
| |
| C:\Windows\System32>npm install vue-router -g |
| |
| added 22 packages in 1s |
| |
| 4 packages are looking for funding |
| run `npm fund` for details |
| |
| C:\Windows\System32>npm install yarn -g |
| |
| added 1 package in 773ms |
| |
| C:\Windows\System32>npm install vue-cli -g |
| npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. |
| npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported |
| npm WARN deprecated har-validator@5.1.5: this library is no longer supported |
| npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https: |
| npm WARN deprecated vue-cli@2.9.6: This package has been deprecated in favour of @vue/cli |
| npm WARN deprecated request@2.88.2: request has been deprecated, see https: |
| npm WARN deprecated consolidate@0.14.5: Please upgrade to consolidate v1.0.0+ as it has been modernized with several long-awaited fixes implemented. Maintenance is supported by Forward Email at https: |
| npm WARN deprecated rimraf@2.7.1: Rimraf versions prior to v4 are no longer supported |
| npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen) |
| |
| added 233 packages in 8s |
| |
| 11 packages are looking for funding |
| run `npm fund` for details |
| |
| C:\Windows\System32>npm list -global |
| D:\software\nodejs\node_global |
| +-- vue-cli@2.9.6 |
| +-- vue-router@4.4.0 |
| +-- vue@3.4.31 |
| `-- yarn@1.22.22 |
- 查看文件夹


| Path=D:\software\nodejs\node_global |
| C:\Users\dogle>vue -V |
| 2.9.6 |
| D:\studyfile>vue init webpack vue01 <--------------------- # 进入d盘 |
| |
| ? Project name vue01 |
| ? Project description A Vue.js project |
| ? Author |
| ? Vue build standalone |
| ? Install vue-router? Yes |
| ? Use ESLint to lint your code? No |
| ? Set up unit tests No |
| ? Setup e2e tests with Nightwatch? No |
| ? Should we run `npm install` for you after the project has been created? (recommended) yarn <--------------------- # 可以指定yarn |
| |
| vue-cli · Generated "vue01". |
| |
| |
| |
| |
| |
| yarn install v1.22.22 |
| info No lockfile found. |
| [1/5] Validating package.json... |
| [2/5] Resolving packages... |
| warning vue |
| warning autoprefixer > browserslist |
| warning babel-core > babel-runtime > core-js |
| warning babel-core > babel-register > core-js |
| warning copy-webpack-plugin > globby > glob |
| warning copy-webpack-plugin > cacache > glob |
| warning copy-webpack-plugin > cacache > rimraf |
| warning copy-webpack-plugin > cacache > rimraf > glob |
| warning copy-webpack-plugin > cacache > move-concurrently |
| warning copy-webpack-plugin > cacache > move-concurrently > rimraf |
| warning copy-webpack-plugin > globby > glob > inflight |
| warning copy-webpack-plugin > cacache > move-concurrently > copy-concurrently |
| warning copy-webpack-plugin > cacache > move-concurrently > copy-concurrently > rimraf |
| warning copy-webpack-plugin > cacache > move-concurrently > fs-write-stream-atomic |
| warning copy-webpack-plugin > cacache > move-concurrently > copy-concurrently > fs-write-stream-atomic |
| warning css-loader > cssnano > autoprefixer > browserslist |
| warning css-loader > cssnano > postcss-merge-rules > browserslist |
| warning css-loader > cssnano > postcss-merge-rules > caniuse-api > browserslist |
| warning css-loader > cssnano > postcss-svgo > svgo |
| warning css-loader > cssnano > postcss-merge-rules > postcss-selector-parser > flatten |
| warning css-loader > cssnano > postcss-svgo > svgo > coa > q |
| |
| (For a CapTP with native promises, see |
| warning extract-text-webpack-plugin |
| warning html-webpack-plugin |
| warning optimize-css-assets-webpack-plugin > cssnano > cssnano-preset-default > postcss-svgo > svgo |
| warning optimize-css-assets-webpack-plugin > cssnano > cssnano-preset-default > postcss-svgo > svgo > coa > q |
| |
| (For a CapTP with native promises, see |
| warning optimize-css-assets-webpack-plugin > cssnano > cssnano-preset-default > postcss-svgo > svgo > stable |
| warning rimraf |
| warning shelljs > glob |
| warning uglifyjs-webpack-plugin > uglify-es |
| warning vue-loader > consolidate |
| warning webpack > acorn-dynamic-import |
| warning webpack > watchpack > watchpack-chokidar2 > chokidar |
| warning webpack > watchpack > watchpack-chokidar2 > chokidar > fsevents |
| warning webpack > watchpack > watchpack-chokidar2 > chokidar > braces > snapdragon > source-map-resolve |
| warning webpack > watchpack > watchpack-chokidar2 > chokidar > braces > snapdragon > source-map-resolve > resolve-url |
| warning webpack > watchpack > watchpack-chokidar2 > chokidar > braces > snapdragon > source-map-resolve > source-map-url |
| warning webpack > watchpack > watchpack-chokidar2 > chokidar > braces > snapdragon > source-map-resolve > urix |
| warning webpack-bundle-analyzer > bfj-node4 |
| warning webpack-dev-server > chokidar |
| warning webpack-dev-server > del > rimraf |
| warning webpack-dev-server > del > globby > glob |
| warning webpack-dev-server > sockjs > uuid |
| [3/5] Fetching packages... |
| [4/5] Linking dependencies... |
| [5/5] Building fresh packages... |
| success Saved lockfile. |
| Done in 45.99s. |
| info There appears to be trouble with your network connection. Retrying... |
| info There appears to be trouble with your network connection. Retrying... |
| info There appears to be trouble with your network connection. Retrying... |
| info There appears to be trouble with your network connection. Retrying... |
| |
| |
| |
| |
| To get started: |
| |
| cd vue01 |
| npm run dev |
| |
| Documentation can be found at https: |
| |
| |
| |
| D:\studyfile>cd vue01 <--------------------- # 进入项目文件夹 |
| |
| D:\studyfile\vue01>yarn install <--------------------- # 安装依赖 |
| yarn install v1.22.22 |
| [1/5] Validating package.json... |
| [2/5] Resolving packages... |
| success Already up-to-date. |
| Done in 0.29s. |
| info There appears to be trouble with your network connection. Retrying... |
| info There appears to be trouble with your network connection. Retrying... |
| info There appears to be trouble with your network connection. Retrying... |
| info There appears to be trouble with your network connection. Retrying... |
| |
| D:\studyfile\vue01>npm run dev <--------------------- # 运行 |
| |
| > vue01 |
| > webpack-dev-server --inline --progress --config build/webpack.dev.conf.js |
| |
| (node:44168) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated. |
| (Use `node --trace-deprecation ...` to show where the warning was created) |
| 12% building modules 24/27 modules 3 active ...ndex=0!D:\studyfile\vue01\src\App.vue{ parser: "babylon" } is deprecated |
| 95% emitting |
| |
| DONE Compiled successfully in 1542ms 18:48:24 |
| |
| I Your application is running here: http: |

| # 使用yarn安装cnpm |
| C:\Users\dogle>yarn add cnpm |
| yarn add v1.22.22 |
| info No lockfile found. |
| [1/4] Resolving packages... |
| warning cnpm > npm > node-gyp > glob@7.2.3: Glob versions prior to v9 are no longer supported |
| warning cnpm > npm > node-gyp > make-fetch-happen > cacache > glob@8.1.0: Glob versions prior to v9 are no longer supported |
| |
| |
| # 查看yarn安装的所有依赖 |
| C:\Users\dogle>yarn list |
| yarn list v1.22.22 |
| warning package.json: No license field |
| warning No license field |
| ├─ @colors/colors@1.5.0 |
| ├─ @fastify/busboy@2.1.1 |
| ├─ @gar/promisify@1.1.3 |
| ├─ @isaacs/cliui@8.0.2 |
| │ ├─ ansi-regex@6.0.1 |
| |
| |
| # 这个时候cnpm被安装到C:\Users\dogle\node_modules |
| |
| # 打开cmd,查看yarn全局bin位置 |
| C:\Users\dogle>yarn global bin |
| warning package.json: No license field |
| D:\software\nodejs\node_global\bin |
| |
| # 查看yarn全局安装位置 |
| C:\Users\dogle>yarn global dir |
| warning package.json: No license field |
| C:\Users\dogle\AppData\Local\Yarn\Data\global |
| |
| # 查看yarn全局cache位置 |
| C:\Users\dogle>yarn cache dir |
| warning package.json: No license field |
| C:\Users\dogle\AppData\Local\Yarn\Cache\v6 |
| |
| # 将上面yarn安装在C:\Users\dogle\node_modules的cnpm卸载,这是该文件就就空了 |
| C:\Users\dogle>yarn remove cnpm |
| yarn remove v1.22.22 |
| warning package.json: No license field |
| [1/2] Removing module cnpm... |
| [2/2] Regenerating lockfile and installing missing dependencies... |
| warning No license field |
| success Uninstalled packages. |
| Done in 1.87s. |
| info There appears to be trouble with your network connection. Retrying... |
| info There appears to be trouble with your network connection. Retrying... |
| info There appears to be trouble with your network connection. Retrying... |
| info There appears to be trouble with your network connection. Retrying... |
| |
| # 将yarn的全局bin位置、全局依赖安装位置、全局cache位置、全局link位置配置到D盘 |
| C:\Users\dogle>yarn config set prefix "D:\software\Yarn\Data" |
| yarn config v1.22.22 |
| warning package.json: No license field |
| success Set "prefix" to "D:\\software\\Yarn\\Data". |
| Done in 0.04s. |
| |
| C:\Users\dogle>yarn config set global-folder "D:\software\Yarn\Data\global" |
| yarn config v1.22.22 |
| warning package.json: No license field |
| success Set "global-folder" to "D:\\software\\Yarn\\Data\\global". |
| Done in 0.04s. |
| |
| C:\Users\dogle>yarn config set cache-folder "D:\software\Yarn\Cache" |
| yarn config v1.22.22 |
| warning package.json: No license field |
| success Set "cache-folder" to "D:\\software\\Yarn\\Cache". |
| Done in 0.04s. |
| |
| C:\Users\dogle>yarn config set link-folder "D:\software\Yarn\Data\link" |
| yarn config v1.22.22 |
| warning package.json: No license field |
| success Set "link-folder" to "D:\\software\\Yarn\\Data\\link". |
| Done in 0.04s. |
| |
| # 删除如下文件夹 |
| # C:\Users\dogle\AppData\Local\Yarn |
| # C:\Users\dogle\node_modules |
| |
| # 安装全局依赖 |
| C:\Users\dogle>yarn global add vite |
| yarn global v1.22.22 |
| warning package.json: No license field |
| [1/4] Resolving packages... |
| [2/4] Fetching packages... |
| [3/4] Linking dependencies... |
| [4/4] Building fresh packages... |
| success Installed "vite@5.3.3" with binaries: |
| - vite |
| Done in 12.33s. |
| info There appears to be trouble with your network connection. Retrying... |
| info There appears to be trouble with your network connection. Retrying... |
| info There appears to be trouble with your network connection. Retrying... |
| info There appears to be trouble with your network connection. Retrying... |
| |
| C:\Users\dogle>yarn global add typescript |
| yarn global v1.22.22 |
| warning package.json: No license field |
| [1/4] Resolving packages... |
| [2/4] Fetching packages... |
| [3/4] Linking dependencies... |
| [4/4] Building fresh packages... |
| success Installed "typescript@5.5.3" with binaries: |
| - tsc |
| - tsserver |
| Done in 1.61s. |
| info There appears to be trouble with your network connection. Retrying... |
| info There appears to be trouble with your network connection. Retrying... |
| info There appears to be trouble with your network connection. Retrying... |
| info There appears to be trouble with your network connection. Retrying... |
| |
| # 查看yarn全局安装的依赖 |
| C:\Users\dogle>yarn global list --depth=0 |
| yarn global v1.22.22 |
| warning package.json: No license field |
| info "typescript@5.5.3" has binaries: |
| - tsc |
| - tsserver |
| info "vite@5.3.3" has binaries: |
| - vite |
| Done in 0.10s. |
-
查看文件夹

-
添加环境变量
| Path=D:\software\Yarn\Data\bin |
| D:\studyfile>vite -v |
| vite/5.3.3 win32-x64 node-v18.14.2 |
| |
| D:\studyfile>tsc |
| Version 5.5.3 |
| tsc: The TypeScript Compiler - Version 5.5.3 |
| # npm全局安装时需要以管理员的身份打开cmd |
| npm install -g <package> |
| # 删除时需要以管理员的身份打开cmd |
| npm uninstall -g <package> |
| |
| # yarn全局安装 |
| yarn global add <package> |
| # 删除全局依赖包 |
| yarn global remove <package> |
- 不推荐使用cnpm命令镜像安装依赖,cnpm使用安装依赖将忽略package-lock.json文件,直接根据package.json去下载依赖。就可能会导致依赖版本不一致,进而产生各种难以排查的问题。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2022-07-06 数据库迁移
2022-07-06 备份与恢复(二)
2022-07-06 备份与恢复(一):mysqldump备份
2022-07-06 同步数据一致性问题
2022-07-06 binlog格式与双主双从
2022-07-06 主从服务器搭建
2022-07-06 主从复制