npm install semantic-ui安装失败
更新:HHH   时间:2023-1-7


今天用npm安装semantic-ui时,提示如下错误:

Microsoft Windows [Version 10.0.17134.648]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>cd c:\myproject

c:\myproject>npm install semantic-ui --save
npm ERR! code EPROTO
npm ERR! errno EPROTO
npm ERR! request to https://registry.npmjs.org/semantic-ui failed, reason: write EPROTO 17148:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:252:
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\admin\AppData\Roaming\npm-cache\_logs\2019-04-16T02_28_41_082Z-debug.log

Google了一把,没找到任何跟这个有关的信息。问了做开发的同事,说有可能是proxy问题,这才想起来,公司电脑访问外网是要走proxy的,于是设置了代理,完美解决问题。在此记录一下npm如何设置proxy的方法:
打开CMD,安装下面的格式根据自己的实际情况设置proxy

$ npm config set proxy http://username:password@proxyserver:port
$ npm config set https-proxy http://username:pawword@proxyserver:port

返回web开发教程...