npm 镜像
npm默认包地址在: https://registry.npmjs.org/ 比较慢
修改包地址:
npm config set registry https://registry.npm.taobao.org
npm config set registry http://mirrors.cloud.tencent.com/npm/
npm config set registry https://registry.npmjs.org/
证书过期
npm http fetch GET https://registry.npm.taobao.org/@babel%2fruntime attempt 1 failed with CERT_HAS_EXPIRED
修改yarn地址:
yarn config set registry 'https://registry.npm.taobao.org'
npm install
当 npm install
时,一直处于执行中但是又看不到进展,因此需要看详细信息。
npm install --loglevel verbose
npm run dev
FAQ
1. 错误
npm ERR! missing script: dev
npm ERR! missing script: start
npm在启动时提示以上错误,是因为引用的包不全,建议 npm install -g
npm install start-script
2. 提示升级
The engine "node" is incompatible with this module. Expected version "^8.12.0 || >=9.7.0". Got "8.11
升级版本或者选择忽略 yarn config set ignore-engines true
3. npm run dev 代码证书异常
[cause]: Error: certificate has expired
at TLSSocket.onConnectSecure (node:_tls_wrap:1674:34)
at TLSSocket.emit (node:events:519:28)
at TLSSocket._finishInit (node:_tls_wrap:1085:8)
at ssl.onhandshakedone (node:_tls_wrap:871:12) {
code: 'CERT_HAS_EXPIRED'
- 查看时间date是否正确 //
- npm cache clean --force //尝试清理缓存
- 删除node_modules,重新npm install