HTTPS代理环境,npm安装webpack

Posted m160331

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HTTPS代理环境,npm安装webpack相关的知识,希望对你有一定的参考价值。

在公司限制使用代理上网的情况下,采用https代理,如下成功安装webpack:

npm配置的用户配置如下:
-------------------------
文件路径:C:Usersxxx.npmrc

-------------------------
prefix=D:programs
ode-v12.14.0-win-x64
ode-global
cache=D:programs
ode-v12.14.0-win-x64
ode-cache
proxy=http://myaccount:mypasswd@myproxy_url:8080/
https-proxy=http://myaccount:mypasswd@myproxy_url:8080/
registry=https://registry.npmjs.org/
strict-ssl=false
cert="-----BEGIN CERTIFICATE-----
MIICiTCCAfKgAwIBAgIERVh2WTANBgkqhkiG9w0BAQQFADCBiDELMAkGA1UEBhMC
SlAxGDAWBgNVBAMTD2JjLWdhdGUub2tpLmNvbTEjMCEGA1UEChQaQlBSICYgSVQg
UGxhbm5pbmcgRGl2aXNpb24xJjAkBgNVBAsTHU9raSBFbGVjdHJpYyBJbmR1c3Ry
eSBDby5MdGQuMRIwEAYDVQQHEwlNaW5hdG8ta3UwHhcNMDYxMTEzMTM0MjQ5WhcN
MzYxMjMxMTM0MjQ5WjCBiDELMAkGA1UEBhMCSlAxGDAWBgNVBAMTD2JjLWdhdGUu
b2tpLmNvbTEjMCEGA1UEChQaQlBSICYgSVQgUGxhbm5pbmcgRGl2aXNpb24xJjAk
BgNVBAsTHU9raSBFbGVjdHJpYyBJbmR1c3RyeSBDby5MdGQuMRIwEAYDVQQHEwlN
aW5hdG8ta3UwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALZgNZ9s2L8J7yUG
cOnv5Y13DZfddGmSLtuglL0aXebxM3gTaxyUhyWMRlbrkgk421me4TcnuGTsvQGl
sgR3bnqKWPmQc9hfUpkevW3lDQd+SKPffAkDSfCcM+L64UnGSfXHCG3Yl5RE18mG
qbJLb/D+Hy7gCVnpydbWkX43MBV5AgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAQdVi
kMV3fh0ApYR3hdyVRPPyztBA+hYn32NVsOuetrU56iMMWq1kuVokOvTl2PFs0uFo
r3gogcIQsbXOJQANXeTEvttnOZFCDh1RWmDNFNLxfWuhZtx7W+MbS3ypN6GVrjkC
B/uqGY4QTEGQxniJSRhYXogR7y5TYDdVSlapi7M=
-----END CERTIFICATE-----"

-------------------------

 

cert是公司的https证书(PEM格式);
严格认证改为false;
日志:

----------------------------[log_ webpack安装_开始]
C:Usersxxx>npm install -g webpack
D:programs
ode-v12.14.0-win-x64
ode-globalwebpack -> D:programs
ode-v12.14.0-win-x64
ode-global
ode_moduleswebpackinwebpack.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_moduleswebpack
ode_modulesfsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ webpack@4.41.4
added 322 packages from 197 contributors in 667.033s
----------------------------[log_ webpack安装_结束]

查看npm-global路径(node-v12.14.0-win-x64 ode-global),已经多了webpack模块。

以上是关于HTTPS代理环境,npm安装webpack的主要内容,如果未能解决你的问题,请参考以下文章

Webpack 安装配置vue环境

webpack+react搭建环境

vue.js + webpack 环境搭建

搭建vue开发环境

如何安装webpack及运行webpack

Windows 环境下vue+webpack前端开发环境搭建