今天我做了一个反应网络项目。因此,它的工作,fine.And,然后,我创建了另一个反应项目。但在这一点上没有任何package.lock文件。所以我使用npm install手动创建了它。但是之后,当我使用npm i react-particles-js命令将依赖项添加到该项目时,我得到了这样一个错误消息。
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文件时,我会得到这条日志消息。
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文件,为什么不能正确安装依赖项?
发布于 2021-09-02 11:33:37
这可能是因为app现在正在使用纱线。
使用yarn
npm i react-particles-js代替npm install使用yarn add react-particle-js您可以确认是否有yarn.lock文件
https://stackoverflow.com/questions/69029399
复制相似问题