Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。
C:\Users\Administrator>npm install -g cnpm --registry=https://registry.npm.taoba
o.org
C:\Users\Administrator\AppData\Roaming\npm\cnpm -> C:\Users\Administrator\AppDat
a\Roaming\npm\node_modules\cnpm\bin\cnpm
npm WARN urllib@2.41.0 requires a peer of proxy-agent@^5.0.0 but none is install
ed. You must install peer dependencies yourself.
+ cnpm@9.2.0
updated 249 packages in 60.364s
C:\Users\Administrator>npm install webpack@4.41.2 webpack-cli -D
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to http://registry.cnpmjs.org/webpack failed, reason: g
etaddrinfo ENOTFOUND registry.cnpmjs.org registry.cnpmjs.org:80
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 settin
gs.
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:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2023-08-23T0
5_54_45_519Z-debug.log
C:\Users\Administrator>
这样的报错如何解决
引用 皆我百晓生 小程序回复内容作答:
这个错误是由于网络连接问题导致的,可能是由于代理设置不正确或者网络连接不稳定引起的。解决方法如下:
检查网络连接是否正常,尝试使用浏览器访问 http://registry.cnpmjs.org/webpack 确认是否能正常访问。
如果你使用代理,请确保代理设置正确,并通过命令 npm config get proxy
验证代理是否设置正确。
可以尝试更换淘宝镜像为其他可用的镜像,例如使用 npm 官方镜像:
通过命令 npm config set registry https://registry.npmjs.org/
来设置。
清除 npm 缓存,并重试安装命令:
通过命令 npm cache clean --force
清除 npm 缓存。
如果上述方法仍然无法解决问题,建议换一个网络环境或者重启电脑后再试。另外,确保你的操作系统和 npm 版本是最新的也是很重要的。
【相关推荐】
最终发现一老哥的博客:https://blog.csdn.net/shichong123/article/details/80617662中
使用 $route.path
可以在刷新后保留到最后点击的那个路由界面,问题得到了解决
关键代码:
<el-menu :default-active="$route.path" router></el-menu>