【问题标题】:Getting an error while "npm install" after deletion of package.lock.json file in the module. [OS - Windows]删除模块中的 package.lock.json 文件后“npm install”出现错误。 [操作系统 - Windows]
【发布时间】:2022-01-25 23:30:32
【问题描述】:

我想删除模块中的package-lock.json 文件并使用 npm install。但是当 npm install 运行时,我收到一条错误消息“无法解析依赖树”。

整个错误: [“无法解析依赖树” 解决时:tpip@0.1.0 找到:react-redux@7.1.0 node_modules/react-redux react-redux@"7.1.0" 来自根项目。 无法解决依赖关系: peer react-redux@"^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0" 来自 redux-form-validators@2.7.5 node_module/reduxform-validators 根项目中的 redux-formvalidators @"^2.7.5" 修复上游依赖冲突,或者重试 此命令带有--force 或--legacy-peer-deps 接受一个不正确的(并且可能被破坏的)依赖解析。

enter image description here

我关注了更多教程和文档。但是我解决不了。

【问题讨论】:

    标签: npm installation react-redux dependencies redux-form-validators


    【解决方案1】:

    有些软件包使用了其他一些软件包。在 npm 版本 7(我的猜测)之后,他们添加了这个警告。这只是为了通知我们这些软件包。

    要解决它,请使用--force

    整个命令:

    npm install --force
    

    这应该可以解决您的问题,并且项目应该可以按预期运行。

    【讨论】:

      【解决方案2】:

      你有一个依赖于旧版本 redux 的包,而你有一个新版本。 您应该使用以下命令:

      npm install --legacy-peer-deps
      

      --legacy-peer-deps 是一种绕过 peerDependency 自动安装的方法,它告诉 NPM 忽略对等依赖项并继续安装。

      请注意,由于潜在的重大更改,这可能会导致冲突

      【讨论】:

        猜你喜欢
        • 2014-05-25
        • 1970-01-01
        • 2014-12-22
        • 1970-01-01
        • 1970-01-01
        • 2018-08-16
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多