首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >npm安装不起作用:"npm ERR!code ERR_SSL_WRONG_VERSION_NUMBER“

npm安装不起作用:"npm ERR!code ERR_SSL_WRONG_VERSION_NUMBER“
EN

Stack Overflow用户
提问于 2021-06-17 17:11:20
回答 1查看 242关注 0票数 0

我无法为我的react应用程序安装模块,当我运行npm i时,它会这样做:

代码语言:javascript
运行
复制
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\marco\Code\backend\node_modules\.staging\setprototypeof-b857a2ac\package.json'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\marco\Code\backend\node_modules\.staging\setprototypeof-b857a2ac\index.d.ts'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\marco\Code\backend\node_modules\.staging\setprototypeof-b857a2ac\index.js'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\marco\Code\backend\node_modules\.staging\setprototypeof-b857a2ac\LICENSE'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\marco\Code\backend\node_modules\.staging\rc-5aecd98b\test\ini.js'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\marco\Code\backend\node_modules\.staging\setprototypeof-b857a2ac\README.md'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\marco\Code\backend\node_modules\.staging\rc-5aecd98b\test\nested-env-vars.js'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\marco\Code\backend\node_modules\.staging\rc-5aecd98b\test\test.js'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\marco\Code\backend\node_modules\.staging\term-size-f230f088\vendor\windows\term-size.exe'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\marco\Code\backend\node_modules\.staging\ast-types-5383d6cc\def\type-annotations.js'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\marco\Code\backend\node_modules\.staging\ast-types-5383d6cc\def\typescript.js'
npm WARN backend@1.0.0 No description
npm WARN backend@1.0.0 No repository field.

npm ERR! code ERR_SSL_WRONG_VERSION_NUMBER
npm ERR! errno ERR_SSL_WRONG_VERSION_NUMBER
npm ERR! request to https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz failed, reason: 4376:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:308:
npm ERR!

我尝试重新安装npm,它也做了同样的事情。我尝试了另一个项目,我得到了相同的错误。我发现了另一个问题,有人有同样的问题,但没有人回答。我甚至尝试将npm注册表设置为http://registry.npmjs.org而不是https://registry.npmjs.org,并将strict-ssl选项设置为false,但仍然不起作用。我的npm版本是6.14.13,我的节点版本是v14.17.1。有什么帮助吗?附言:我没有使用代理

EN

回答 1

Stack Overflow用户

发布于 2021-06-17 17:44:22

快速的解决方案是删除node_modulespackage-lock.json,这样当您重新安装这些包时,它们将随lockfileVersion@1而不是lockfileVersion@2一起安装。

不过,我不会建议这种解决方案,因为如果你在一个团队中工作,你会强迫其他人做同样的事情来修复它。

问题是npm版本v6.x.x支持lockfileVersion@1,而v7.x.x支持lockfileVersion@2

因此,更好的解决方案是简单地将npm版本更新为v7或更高版本。

在这里你可以找到一个有趣的相关讨论:Is there any way to fix package-lock.json lockfileVersion so npm uses a specific format?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68016332

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档