【问题标题】:react-messenger-customer-chat - errors while installing npmreact-messenger-customer-chat - 安装 npm 时出错
【发布时间】:2021-08-30 07:09:29
【问题描述】:

有人在安装-react-messenger-customer-chat 时遇到这个问题吗? [Next.js,顺风] 这里是 github 仓库:https://github.com/Yoctol/react-messenger-customer-chat

package.json

{
  "name": "with-tailwindcss",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start"
  },
  "dependencies": {
    "@headlessui/react": "^1.2.0",
    "graphql": "^15.5.0",
    "graphql-request": "^3.4.0",
    "he": "^1.2.0",
    "mdx-bundler": "^4.1.0",
    "next": "^10.2.3",
    "next-themes": "^0.0.14",
    "react": "^17.0.2",
    "react-dom": "^17.0.1",
    "react-icons": "^4.2.0",
    "sitemap": "^7.0.0"
  },
  "devDependencies": {
    "autoprefixer": "^10.2.6",
    "postcss": "^8.3.0",
    "tailwindcss": "^2.1.4"
  }
}

我现在应该做什么? 编辑1:

npm i -S react@^16.x.x

错误:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: react@16.14.0
npm ERR! node_modules/react
npm ERR!   react@"16.x.x" from the root project
npm ERR!   peer react@">=16" from @headlessui/react@1.2.0
npm ERR!   node_modules/@headlessui/react
npm ERR!     @headlessui/react@"^1.2.0" from the root project
npm ERR!   6 more (@next/react-dev-overlay, next, next-themes, react-icons, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"17.0.2" from react-dom@17.0.2
npm ERR! node_modules/react-dom
npm ERR!   peer react-dom@"^16.9.0 || ^17" from @next/react-dev-overlay@10.2.3
npm ERR!   node_modules/@next/react-dev-overlay
npm ERR!     @next/react-dev-overlay@"10.2.3" from next@10.2.3
npm ERR!     node_modules/next
npm ERR!       peer next@"*" from next-themes@0.0.14
npm ERR!       node_modules/next-themes
npm ERR!       1 more (the root project)
npm ERR!   peer react-dom@"^16.6.0 || ^17" from next@10.2.3
npm ERR!   node_modules/next
npm ERR!     peer next@"*" from next-themes@0.0.14
npm ERR!     node_modules/next-themes
npm ERR!       next-themes@"^0.0.14" from the root project
npm ERR!     1 more (the root project)
npm ERR!   2 more (next-themes, 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\bubuq3\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\bubuq3\AppData\Local\npm-cache\_logs\2021-06-14T11_30_57_998Z-debug.log

所以我现在需要旧版本的 next-themes 和 react-dom 等?

【问题讨论】:

    标签: reactjs next.js tailwind-css facebook-chatbot


    【解决方案1】:

    问题出在这里:

    npm ERR! node_modules/react
    npm ERR! react@"^17.0.2" from the root project
    
    npm ERR! Could not resolve dependency:
    npm ERR! peer react@"^0.14.0 || ^15.0.0-0 || ^16.0.0-0" from react-messenger-customer-chat@0.8.0
    

    您已安装 react v.17,但 react-messenger-customer-chat 需要版本 15 或 16。您可以安装 react比如16个这样的:

    npm i -S react@^16.x.x
    

    【讨论】:

    • 我想安装旧版本的 react 时出错。看来我必须安装旧版本的软件包..
    • 你的意思是你所有的包裹?错误是什么样的?
    • 我用错误更新了帖子。好像是 react-dom 但不知道是哪个版本:react-dom@"^16.9.0?
    • 首先,您应该删除node_modules 文件夹。然后你可以安装 react-dom 版本 16。next-themes 对我来说看起来不错。
    • 删除了文件夹,然后我想安装 npm i -S react@^16.x.x 并再次出现同样的错误
    猜你喜欢
    • 2021-05-11
    • 2017-03-29
    • 1970-01-01
    • 1970-01-01
    • 2020-07-23
    • 2020-01-21
    • 1970-01-01
    • 2016-06-22
    • 1970-01-01
    相关资源
    最近更新 更多