npm install 报错内容:
gyp ERR! configure error gyp ERR! stack Error
[ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match
certificate’s altnames: Host: npm.taobao.org. is not in the cert’s
altnames: DNS:.tbcdn.cn, DNS:.taobao.com, DNS:.alicdn.com,
DNS:.cmos.greencompute.org, DNS:cmos.greencompute.org,
DNS:m.intl.taobao.com, DNS:.mobgslb.tbcache.com, DNS:.alikunlun.com,
DNS:alikunlun.com, DNS:.django.t.taobao.com, DNS:alicdn.com,
DNS:.tbcache.com, DNS:.tmall.com, DNS:.1688.com,
DNS:.3c.tmall.com, DNS:.alibaba.com, DNS:.aliexpress.com,
DNS:.aliqin.tmall.com, DNS:.alitrip.com, DNS:.aliyun.com,
DNS:.cainiao.com, DNS:.cainiao.com.cn, DNS:.chi.taobao.com,
DNS:.chi.tmall.com, DNS:.china.taobao.com, DNS:.dingtalk.com,
DNS:.etao.com, DNS:.feizhu.cn, DNS:.feizhu.com, DNS:.fliggy.com,
DNS:.fliggy.hk, DNS:.food.tmall.com, DNS:.jia.taobao.com,
DNS:.jia.tmall.com, DNS:.ju.taobao.com, DNS:.juhuasuan.com,
DNS:.lw.aliimg.com, DNS:.m.1688.com, DNS:.m.alibaba.com,
DNS:.m.alitrip.com, DNS:.m.cainiao.com, DNS:.m.etao.com,
DNS:.m.taobao.com, DNS:.m.taopiaopiao.com, DNS:.m.tmall.com,
DNS:.m.tmall.hk, DNS:.mei.com, DNS:.taopiaopiao.com,
DNS:.tmall.hk, DNS:.trip.taobao.com, DNS:.xiami.com, DNS:1688.com,
DNS:alibaba.com, DNS:aliexpress.com, DNS:alitrip.com, DNS:aliyun.com,
DNS:cainiao.com, DNS:cainiao.com.cn, DNS:dingtalk.com, DNS:etao.com,
DNS:feizhu.cn, DNS:feizhu.com, DNS:fliggy.com, DNS:fliggy.hk,
DNS:juhuasuan.com, DNS:mei.com, DNS:taobao.com, DNS:taopiaopiao.com,
DNS:tmall.hk, DNS:xiami.com, DNS:tmall.com,
DNS:.cloudvideocdn.taobao.com, DNS:cloudvideocdn.taobao.com,
DNS:tbcdn.cn gyp ERR! stack at new NodeError
(internal/errors.js:322:7) gyp ERR! stack at
Object.checkServerIdentity (tls.js:347:12) gyp ERR! stack at
TLSSocket.onConnectSecure (_tls_wrap.js:1525:27) gyp ERR! stack at
TLSSocket.emit (events.js:400:28) gyp ERR! stack at
TLSSocket._finishInit (_tls_wrap.js:937:8) gyp ERR! stack at
TLSWrap.ssl.onhandshakedone (_tls_wrap.js:709:12) gyp ERR! System
Windows_NT 10.0.19045 gyp ERR! command “D:\node14\node.exe”
“D:\hospital\hospital-web-master\hospital-web-master\node_modules\node-gyp\bin\node-gyp.js”
“rebuild” “–verbose” “–libsass_ext=” “–libsass_cflags=”
“–libsass_ldflags=” “–libsass_library=” gyp ERR! cwd
D:\hospital\hospital-web-master\hospital-web-master\node_modules\node-sass
gyp ERR! node -v v14.21.3 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok
Build failed with error code: 1 npm WARN optional SKIPPING OPTIONAL
DEPENDENCY: fsevents@1.2.11 (node_modules\fsevents): npm WARN notsup
SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for
fsevents@1.2.11: wanted {“os”:“darwin”,“arch”:“any”} (current:
{“os”:“win32”,“arch”:“x64”})npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! node-sass@4.14.1
postinstall:node scripts/build.js
npm ERR! Exit status 1 npm ERR!
npm ERR! Failed at the node-sass@4.14.1 postinstall script. npm ERR!
This is probably not a problem with npm. There is likely additional
logging output above.npm ERR! A complete log of this run can be found in: npm ERR!
D:\nodejs\node_cache_logs\2024-05-05T01_16_09_366Z-debug.log
从github拉取的前几年的项目
npm install 直接报错
1.排查过node,node-sass,sass-loader的版本,无效
2.更换过淘宝最新的镜像源,无效
3.什么安装cnpm啥的全都试过,无效
但在是室友的电脑上跑,直接成功 猜想还是镜像源的问题
npm config list --global 查看全局的配置变量
发现了问题
chromedriver-cdnurl = “https://npm.taobao.org/mirrors/chromedriver”
couchbase-binary-host-mirror =
“https://npm.taobao.org/mirrors/couchbase/v{version}”
debug-binary-host-mirror =
“https://npm.taobao.org/mirrors/node-inspector” disturl =
“https://npm.taobao.org/dist” electron-mirror =
“https://npm.taobao.org/mirrors/electron/” files\python.exe = “”
flow-bin-binary-host-mirror = “https://npm.taobao.org/mirrors/flow/v”
fse-binary-host-mirror = “https://npm.taobao.org/mirrors/fsevents”
fuse-bindings-binary-host-mirror =
“https://npm.taobao.org/mirrors/fuse-bindings/v{version}”
git4win-mirror = “https://npm.taobao.org/mirrors/git-for-windows”
gl-binary-host-mirror = “https://npm.taobao.org/mirrors/gl/v{version}”
grpc-node-binary-host-mirror = “https://npm.taobao.org/mirrors”
hackrf-binary-host-mirror =
“https://npm.taobao.org/mirrors/hackrf/v{version}”
leveldown-binary-host-mirror =
“https://npm.taobao.org/mirrors/leveldown/v{version}”
leveldown-hyper-binary-host-mirror =
“https://npm.taobao.org/mirrors/leveldown-hyper/v{version}”
mknod-binary-host-mirror =
“https://npm.taobao.org/mirrors/mknod/v{version}”
node-sqlite3-binary-host-mirror = “https://npm.taobao.org/mirrors”
node-tk5-binary-host-mirror =
“https://npm.taobao.org/mirrors/node-tk5/v{version}”
nodegit-binary-host-mirror =
“https://npm.taobao.org/mirrors/nodegit/v{version}/”
operadriver-cdnurl = “https://npm.taobao.org/mirrors/operadriver”
phantomjs-cdnurl = “https://npm.taobao.org/mirrors/phantomjs” prefix =
“D:\nodejs\node_global” profiler-binary-host-mirror =
“https://npm.taobao.org/mirrors/node-inspector/”
puppeteer-download-host = “https://npm.taobao.org/mirrors” python =
“D:\python2\python.exe” python-mirror =
“https://npm.taobao.org/mirrors/python” rabin-binary-host-mirror =
“https://npm.taobao.org/mirrors/rabin/v{version}” registry =
“https://registry.npmmirror.com/” sass-binary-site =
“https://npm.taobao.org/mirrors/node-sass” sass_binary_site =
“https://npm.taobao.org/mirrors/node-sass” sqlite3-binary-site =
“https://npm.taobao.org/mirrors/sqlite3” strict-ssl = false
utf-8-validate-binary-host-mirror =
“https://npm.taobao.org/mirrors/utf-8-validate/v{version}”
utp-native-binary-host-mirror =
“https://npm.taobao.org/mirrors/utp-native/v{version}”
zmq-prebuilt-binary-host-mirror =
“https://npm.taobao.org/mirrors/zmq-prebuilt/v{version}”
多出了很多老版本淘宝镜像源的配置
猜想这些变量镜像源的优先级应该高于全局
从.npmrc文件中 C:\Users\86199.npmrc 删除了老版本淘宝镜像源的一系列配置
然后在命令行设置全局淘宝最新的registry https://registry.npmmirror.com/
npm install 成功 完结撒花 两天坐牢…