gatsby-plugin-image 没有通过 npm 安装
gatsby-plugin-image not installing via npm
我正在尝试根据文档 https://www.gatsbyjs.com/plugins/gatsby-plugin-image#installation
通过 npm 安装 gatsby-plugin-image
在终端中收到以下错误:
$ npm install gatsby-plugin-image gatsby-plugin-sharp gatsby-source-filesystem gatsby-transformer-sharp
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: gatsby-starter-hello-world@0.1.0
npm ERR! Found: gatsby@2.32.9
npm ERR! node_modules/gatsby
npm ERR! gatsby@"^2.26.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer gatsby@"^3.0.0-next.0" from gatsby-plugin-image@1.0.0
npm ERR! node_modules/gatsby-plugin-image
npm ERR! gatsby-plugin-image@"*" 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.
Package.json 来自 gatsby starter 库中的 hello world starter:
{
"name": "gatsby-starter-hello-world",
"private": true,
"description": "A simplified bare-bones starter for Gatsby",
"version": "0.1.0",
"license": "0BSD",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"",
"start": "npm run develop",
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
},
"dependencies": {
"babel-plugin-styled-components": "^1.12.0",
"gatsby": "^2.26.1",
"gatsby-plugin-styled-components": "^3.10.0",
"gatsby-source-filesystem": "^2.11.1",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"styled-components": "^5.2.1"
},
"devDependencies": {
"prettier": "2.2.1"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-hello-world"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
}
}
我在 GH 存储库或 Google 搜索中没有看到任何与此相关的问题。已尝试 https://www.gatsbyjs.com/docs/how-to/local-development/troubleshooting-common-errors/ 上的故障排除提示,但没有成功。没有使用 --force 运行 npm 安装的经验。有什么需要注意的吗?如果我强制安装,我能恢复吗?提前致谢!
您似乎正在使用 npm v7
,因此适合您的命令 according to the docs 是:
npm install gatsby@latest --legacy-peer-deps
那么,您将能够运行:
npm install gatsby-plugin-image gatsby-plugin-sharp gatsby-transformer-sharp
或者,您可以尝试通过以下方式向它们添加遗留对等依赖项:
npm install gatsby-plugin-image gatsby-plugin-sharp gatsby-transformer-sharp --legacy-peer-deps
我正在尝试根据文档 https://www.gatsbyjs.com/plugins/gatsby-plugin-image#installation
通过 npm 安装 gatsby-plugin-image在终端中收到以下错误:
$ npm install gatsby-plugin-image gatsby-plugin-sharp gatsby-source-filesystem gatsby-transformer-sharp
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: gatsby-starter-hello-world@0.1.0
npm ERR! Found: gatsby@2.32.9
npm ERR! node_modules/gatsby
npm ERR! gatsby@"^2.26.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer gatsby@"^3.0.0-next.0" from gatsby-plugin-image@1.0.0
npm ERR! node_modules/gatsby-plugin-image
npm ERR! gatsby-plugin-image@"*" 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.
Package.json 来自 gatsby starter 库中的 hello world starter:
{
"name": "gatsby-starter-hello-world",
"private": true,
"description": "A simplified bare-bones starter for Gatsby",
"version": "0.1.0",
"license": "0BSD",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"",
"start": "npm run develop",
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
},
"dependencies": {
"babel-plugin-styled-components": "^1.12.0",
"gatsby": "^2.26.1",
"gatsby-plugin-styled-components": "^3.10.0",
"gatsby-source-filesystem": "^2.11.1",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"styled-components": "^5.2.1"
},
"devDependencies": {
"prettier": "2.2.1"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-hello-world"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
}
}
我在 GH 存储库或 Google 搜索中没有看到任何与此相关的问题。已尝试 https://www.gatsbyjs.com/docs/how-to/local-development/troubleshooting-common-errors/ 上的故障排除提示,但没有成功。没有使用 --force 运行 npm 安装的经验。有什么需要注意的吗?如果我强制安装,我能恢复吗?提前致谢!
您似乎正在使用 npm v7
,因此适合您的命令 according to the docs 是:
npm install gatsby@latest --legacy-peer-deps
那么,您将能够运行:
npm install gatsby-plugin-image gatsby-plugin-sharp gatsby-transformer-sharp
或者,您可以尝试通过以下方式向它们添加遗留对等依赖项:
npm install gatsby-plugin-image gatsby-plugin-sharp gatsby-transformer-sharp --legacy-peer-deps