我正在尝试在 netlify 上托管我的 React 网站,但出现 npm 安装错误
I am trying to host my react website on netlify but there is a npm install error
我需要一些帮助!我正在尝试在 netlify 上托管我的 reacy 网站,但发生 npm 安装错误。你能帮我解决这个问题吗?
这里是错误评论
12:28:19 AM: Installing NPM modules using NPM version 7.24.0
12:28:21 AM: npm ERR! code ERESOLVE
12:28:21 AM: npm ERR! ERESOLVE unable to resolve dependency tree
12:28:21 AM: npm ERR!
12:28:21 AM: npm ERR! While resolving: simplefolio@1.0.1
12:28:21 AM: npm ERR! Found: webpack@5.54.0
12:28:21 AM: npm ERR! node_modules/webpack
12:28:21 AM: npm ERR! dev webpack@"^5.40.0" from the root project
12:28:21 AM: npm ERR!
12:28:21 AM: npm ERR! Could not resolve dependency:
12:28:21 AM: npm ERR! peer webpack@"^4.0.0" from optimize-css-assets-webpack-plugin@6.0.1
12:28:21 AM: npm ERR! node_modules/optimize-css-assets-webpack-plugin
12:28:21 AM: npm ERR! dev optimize-css-assets-webpack-plugin@"^6.0.1" from the root project
12:28:21 AM: npm ERR!
12:28:21 AM: npm ERR! Fix the upstream dependency conflict, or retry
12:28:21 AM: npm ERR! this command with --force, or --legacy-peer-deps
12:28:21 AM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
12:28:21 AM: npm ERR!
12:28:21 AM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
12:28:21 AM: npm ERR! A complete log of this run can be found in:
12:28:21 AM: npm ERR! /opt/buildhome/.npm/_logs/2021-09-27T15_28_21_272Z-debug.log
提前感谢您的帮助
您好,欢迎来到社区!
node_modules
和 package-lock.json
可能不再与您当前的 npm 版本兼容。
在您的本地安装上尝试:
rm node_modules
rm package-lock.json
npm install
然后在 github 上重新提交并重新部署到 Netlify!
即使您不是直接调用 npm
,而是通过 gatsby build
,您仍然应该能够配置 npm
以使用带有 [=14] 的所需标志=] 文件。只需将名为 .npmrc
的文件添加到您的存储库的根目录,其中包含以下内容
legacy-peer-deps=true
我需要一些帮助!我正在尝试在 netlify 上托管我的 reacy 网站,但发生 npm 安装错误。你能帮我解决这个问题吗?
这里是错误评论
12:28:19 AM: Installing NPM modules using NPM version 7.24.0
12:28:21 AM: npm ERR! code ERESOLVE
12:28:21 AM: npm ERR! ERESOLVE unable to resolve dependency tree
12:28:21 AM: npm ERR!
12:28:21 AM: npm ERR! While resolving: simplefolio@1.0.1
12:28:21 AM: npm ERR! Found: webpack@5.54.0
12:28:21 AM: npm ERR! node_modules/webpack
12:28:21 AM: npm ERR! dev webpack@"^5.40.0" from the root project
12:28:21 AM: npm ERR!
12:28:21 AM: npm ERR! Could not resolve dependency:
12:28:21 AM: npm ERR! peer webpack@"^4.0.0" from optimize-css-assets-webpack-plugin@6.0.1
12:28:21 AM: npm ERR! node_modules/optimize-css-assets-webpack-plugin
12:28:21 AM: npm ERR! dev optimize-css-assets-webpack-plugin@"^6.0.1" from the root project
12:28:21 AM: npm ERR!
12:28:21 AM: npm ERR! Fix the upstream dependency conflict, or retry
12:28:21 AM: npm ERR! this command with --force, or --legacy-peer-deps
12:28:21 AM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
12:28:21 AM: npm ERR!
12:28:21 AM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
12:28:21 AM: npm ERR! A complete log of this run can be found in:
12:28:21 AM: npm ERR! /opt/buildhome/.npm/_logs/2021-09-27T15_28_21_272Z-debug.log
提前感谢您的帮助
您好,欢迎来到社区!
node_modules
和 package-lock.json
可能不再与您当前的 npm 版本兼容。
在您的本地安装上尝试:
rm node_modules
rm package-lock.json
npm install
然后在 github 上重新提交并重新部署到 Netlify!
即使您不是直接调用 npm
,而是通过 gatsby build
,您仍然应该能够配置 npm
以使用带有 [=14] 的所需标志=] 文件。只需将名为 .npmrc
的文件添加到您的存储库的根目录,其中包含以下内容
legacy-peer-deps=true