首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >创建-反应-应用程序不生成package.lock文件

创建-反应-应用程序不生成package.lock文件
EN

Stack Overflow用户
提问于 2021-09-02 11:29:47
回答 1查看 887关注 0票数 0

今天我做了一个反应网络项目。因此,它的工作,fine.And,然后,我创建了另一个反应项目。但在这一点上没有任何package.lock文件。所以我使用npm install手动创建了它。但是之后,当我使用npm i react-particles-js命令将依赖项添加到该项目时,我得到了这样一个错误消息。

代码语言:javascript
复制
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: smart-parking-system@0.1.0
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   react@"^17.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.0.0" from react-particles-js@3.5.3
npm ERR! node_modules/react-particles-js
npm ERR!   react-particles-js@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\User.LAPTOP-3EBUUP6S\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\User.LAPTOP-3EBUUP6S\AppData\Local\npm-cache\_logs\2021-09-02T11_17_21_426Z-debug.log

另外,当我手动创建package.lock文件时,我会得到这条日志消息。

代码语言:javascript
复制
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

changed 87 packages, and audited 1703 packages in 40s

,所以问题是为什么我没有自动获得package.lock文件,为什么不能正确安装依赖项?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-09-02 11:33:37

这可能是因为app现在正在使用纱线。

使用yarn

  • Instead of npm i react-particles-js代替npm install使用yarn add react-particle-js

您可以确认是否有yarn.lock文件

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

https://stackoverflow.com/questions/69029399

复制
相关文章

相似问题

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