问题:我学习vue3的时候刚开始创建项目的时候就有问题了,一开始是卡住一动不动

排查问题: 一开始卡住不动的时候先看下自己的node.js是否是15版本以上的,因为vue3,只支持在node.js 版本在15以上的,一般都会重新安装最新的版本,需要注意的是安装完node 后要重启下电脑.

 在安装完最新版本后就会有这个报错

PS D:\desktop> npm create vue@latest
npm ERR! code ETIMEDOUT
npm ERR! syscall connect
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/create-vue failed, reason: connect ETIMEDOUT 104.16.31.34:443
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! A complete log of this run can be found in: C:\Users\初心\AppData\Local\npm-cache\_logs\2024-04-10T01_52_43_780Z-debug-0.log

问题排查:发现是npm镜像的问题,旧的镜像使用的是

https://registry.npm.taobao.org/

把镜像指令更改下就可以了

npm config set registry=https://registry.npmmirror.com
Windows PowerShell
版权所有(C) Microsoft Corporation。保留所有权利。

安装最新的 PowerShell,了解新功能和改进!https://aka.ms/PSWindows

PS D:\desktop> npm create vue@latest
npm ERR! code ETIMEDOUT
npm ERR! syscall connect
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/create-vue failed, reason: connect ETIMEDOUT 104.16.31.34:443
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! A complete log of this run can be found in: C:\Users\初心\AppData\Local\npm-cache\_logs\2024-04-10T01_52_43_780Z-debug-0.log
PS D:\desktop> npm config set registry=https://registry.npmmirror.com
PS D:\desktop> npm create vue@latest
Need to install the following packages:
create-vue@3.10.2

思路来源于创建vue3项目运行npm create vue@latest报错

GitHub 加速计划 / vu / vue
85
16
下载
vuejs/vue: 是一个用于构建用户界面的 JavaScript 框架,具有简洁的语法和丰富的组件库,可以用于开发单页面应用程序和多页面应用程序。
最近提交(Master分支:5 个月前 )
9e887079 [skip ci] 3 个月前
73486cb5 * chore: fix link broken Signed-off-by: snoppy <michaleli@foxmail.com> * Update packages/template-compiler/README.md [skip ci] --------- Signed-off-by: snoppy <michaleli@foxmail.com> Co-authored-by: Eduardo San Martin Morote <posva@users.noreply.github.com> 7 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐