npm create-react-app 项目名报错

**

npm create-react-app 项目名报错

**

npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY

npm ERR! errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY

npm ERR! request to https://registry.npmjs.org/create-react-app failed, reason: unable to get local issuer certificate

npm ERR! A complete log of this run can be found in:

npm ERR! C:\Users\00\AppData\Local\npm-cache_logs\2024-07-22T02_31_01_751Z-debug.log

log:

javascript 复制代码
0 verbose cli [
0 verbose cli   'D:\\00\\soft\\nodejs\\node.exe',
0 verbose cli   'D:\\00\\soft\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
0 verbose cli   'i',
0 verbose cli   '-g',
0 verbose cli   'create-react-app'
0 verbose cli ]
1 info using [email protected]
2 info using [email protected]
3 timing config:load:defaults Completed in 2ms
4 timing config:load:file:D:\00\soft\nodejs\node_modules\npm\npmrc Completed in 2ms
5 timing config:load:builtin Completed in 2ms
6 timing config:load:cli Completed in 4ms
7 timing config:load:env Completed in 1ms
8 timing config:load:file:D:\00\work\Code\CircleBrowser\circlebrowser\.npmrc Completed in 0ms
9 timing config:load:project Completed in 3ms
10 timing config:load:file:C:\Users\00\.npmrc Completed in 1ms
11 timing config:load:user Completed in 1ms
12 timing config:load:file:C:\Users\00\AppData\Roaming\npm\etc\npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 0ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:setUserAgent Completed in 1ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 16ms
19 verbose npm-session fef4bbb1de42b3a8
20 timing npm:load Completed in 25ms
21 timing arborist:ctor Completed in 1ms
22 timing idealTree:init Completed in 14ms
23 timing idealTree:userRequests Completed in 3ms
24 silly idealTree buildDeps
25 silly fetch manifest create-react-app@*
26 silly placeDep ROOT create-react-app@ OK for:  want: *
27 timing idealTree:#root Completed in 544ms
28 timing idealTree:node_modules/create-react-app Completed in 0ms
29 timing idealTree:buildDeps Completed in 546ms
30 timing idealTree:fixDepFlags Completed in 0ms
31 timing idealTree Completed in 566ms
32 timing command:i Completed in 573ms
33 verbose type system
34 verbose stack FetchError: request to https://registry.npmjs.org/create-react-app failed, reason: unable to get local issuer certificate
34 verbose stack     at ClientRequest.<anonymous> (D:\00\soft\nodejs\node_modules\npm\node_modules\minipass-fetch\lib\index.js:97:14)
34 verbose stack     at ClientRequest.emit (node:events:369:20)
34 verbose stack     at TLSSocket.socketErrorListener (node:_http_client:462:9)
34 verbose stack     at TLSSocket.emit (node:events:381:22)
34 verbose stack     at emitErrorNT (node:internal/streams/destroy:188:8)
34 verbose stack     at emitErrorCloseNT (node:internal/streams/destroy:153:3)
34 verbose stack     at processTicksAndRejections (node:internal/process/task_queues:81:21)
35 verbose cwd D:\00\work\Code\CircleBrowser\circlebrowser
36 verbose Windows_NT 10.0.22631
37 verbose argv "D:\\00\\soft\\nodejs\\node.exe" "D:\\00\\soft\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i" "-g" "create-react-app"
38 verbose node v15.12.0
39 verbose npm  v7.6.3
40 error code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
41 error errno UNABLE_TO_GET_ISSUER_CERT_LOCALLY
42 error request to https://registry.npmjs.org/create-react-app failed, reason: unable to get local issuer certificate
43 verbose exit 1

证书过期。

解决方法:

javascript 复制代码
 npm config set strict-ssl false
 npm config set registry http://registry.npmjs.org/

这将禁用严格的SSL验证,并将registry更改为http而不是https

相关推荐
阿山同学.12 分钟前
AWS 亚马逊 S3存储桶直传 前端demo 复制即可使用
前端·javascript·aws
Jolyne_21 分钟前
grid 实现完美的水平铺满、间隔一致的自适应布局
前端·css
西洼工作室25 分钟前
【解决导航栏字体图标渲染导致文本闪烁问题】采用腾讯视频的解决方案
前端·css·css3
WindrunnerMax32 分钟前
从零实现富文本编辑器#5-编辑器选区模型的状态结构表达
前端·架构·github
CodeSheep38 分钟前
宇树科技,改名了!
前端·后端·程序员
Hilaku1 小时前
为什么我们用了 Vite 还是构建慢?——真正的优化在这几步
前端·javascript·vite
XI锐真的烦1 小时前
横向对比npm和yarn
前端·npm·node.js
国家不保护废物1 小时前
🧩 React 组件化进阶:像乐高大师一样搭建你的应用世界!
前端·react.js·ai编程
TimelessHaze1 小时前
从"切图崽"到前端工程师:React 到底是个啥?🚀
前端·react.js·ai编程
站在风口的猪11081 小时前
《前端面试题:CSS的display属性》
前端·css·html·css3·html5