解决前端安装sharp出错问题sharp: Command failed.

Posted 糖~豆豆

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决前端安装sharp出错问题sharp: Command failed.相关的知识,希望对你有一定的参考价值。

报错如下:sharp: Command failed.

cd C:\\Users\\xxx-api && yarn install

yarn install v1.22.19un\\Documents\\my_files\\A-Web-Project\\service-categories\\service-categories-api> cd .\\service-categories-api\\
info No lockfile found.
[1/5] Validating package.json...
[2/5] Resolving packages...
warning @strapi/strapi > koa-body > formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
warning @strapi/strapi > @strapi/plugin-email > @strapi/provider-email-sendmail > sendmail > mailcomposer@3.12.0: This project is unmaintained
warning @strapi/strapi > @strapi/plugin-email > @strapi/provider-email-sendmail > sendmail > mailcomposer > buildmail@3.10.0: This project is unmaintained
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
[3/5] Fetching packages...
[4/5] Linking dependencies...
warning "@strapi/strapi > @strapi/plugin-email@4.9.0" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-email@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-email@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning "@strapi/strapi > @strapi/plugin-email@4.9.0" has unmet peer dependency "styled-components@5.3.3".
warning "@strapi/strapi > @strapi/plugin-content-type-builder@4.9.0" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-content-type-builder@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-content-type-builder@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning "@strapi/strapi > @strapi/plugin-content-type-builder@4.9.0" has unmet peer dependency "styled-components@5.3.3".
warning "@strapi/strapi > @strapi/plugin-upload@4.9.0" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-upload@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-upload@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning "@strapi/strapi > @strapi/plugin-upload@4.9.0" has unmet peer dependency "styled-components@5.3.3".
warning "@strapi/plugin-users-permissions > @strapi/design-system@1.6.6" has unmet peer dependency "react@^17.0.1".
warning "@strapi/plugin-users-permissions > @strapi/design-system@1.6.6" has unmet peer dependency "react-dom@^17.0.1".
warning "@strapi/plugin-users-permissions > @strapi/design-system@1.6.6" has unmet peer dependency "react-router-dom@^5.2.0".
warning "@strapi/plugin-users-permissions > @strapi/design-system@1.6.6" has unmet peer dependency "styled-components@^5.2.1".
warning "@strapi/plugin-users-permissions > @strapi/helper-plugin@4.9.0" has unmet peer dependency "react@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/helper-plugin@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/helper-plugin@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning "@strapi/plugin-users-permissions > @strapi/helper-plugin@4.9.0" has unmet peer dependency "styled-components@5.3.3".
warning "@strapi/plugin-users-permissions > @strapi/icons@1.6.6" has unmet peer dependency "react@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/icons@1.6.6" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/plugin-users-permissions > formik@2.2.9" has unmet peer dependency "react@>=16.8.0".
warning "@strapi/plugin-users-permissions > react-intl@6.3.2" has unmet peer dependency "react@^16.6.0 || 17 || 18".
warning "@strapi/plugin-users-permissions > react-query@3.24.3" has unmet peer dependency "react@^16.8.0 || ^17.0.0".
warning "@strapi/plugin-users-permissions > react-redux@8.0.5" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror@4.19.11" has unmet peer dependency "@codemirror/state@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror@4.19.11" has unmet peer dependency "@codemirror/theme-one-dark@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror@4.19.11" has unmet peer dependency "@codemirror/view@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror@4.19.11" has unmet peer dependency "codemirror@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.19.11" has unmet peer dependency "@codemirror/autocomplete@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.19.11" has unmet peer dependency "@codemirror/language@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.19.11" has unmet peer dependency "@codemirror/lint@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.19.11" has unmet peer dependency "@codemirror/search@>=6.0.0".warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.19.11" has unmet peer dependency "@codemirror/view@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > codemirror > @codemirror/autocomplete@6.4.2" has unmet peer dependency "@lezer/common@^1.0.0".
warning " > @strapi/plugin-users-permissions@4.9.0" has unmet peer dependency "react@^17.0.2".
warning " > @strapi/plugin-users-permissions@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning " > @strapi/plugin-users-permissions@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning " > @strapi/plugin-users-permissions@4.9.0" has unmet peer dependency "styled-components@5.3.3".
warning " > @strapi/plugin-i18n@4.9.0" has unmet peer dependency "react@^17.0.2".
warning " > @strapi/plugin-i18n@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning " > @strapi/plugin-i18n@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning " > @strapi/plugin-i18n@4.9.0" has unmet peer dependency "styled-components@5.3.3".
[5/5] Building fresh packages...
[-/5] ⠄ waiting...
[-/5] ⡀ waiting...
[3/5] ⡀ sharp
[-/5] ⡀ waiting...
error C:\\Users\\xxx-api\\node_modules\\sharp: Command failed.
Exit code: 1
Command: (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
Arguments:
Directory: C:\\Users\\xxx-api\\node_modules\\sharp
Output:




PS C:\\Users\\xxx-api> node install/libvips && node install/dll-copy && prebuild-install
At line:1 char:22
+ node install/libvips && node install/dll-copy && prebuild-install
+                      ~~
The token \'&&\' is not a valid statement separator in this version.
At line:1 char:47
+ node install/libvips && node install/dll-copy && prebuild-install
+                                               ~~
The token \'&&\' is not a valid statement separator in this version.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : InvalidEndOfLine

PS C:\\Users\\xxx-api> npm config set sharp_binary_host "https://npm.taobao.org/mirrors/sharp"
PS C:\\Users\\xxx-api> npm config set sharp_libvips_binary_host "https://npm.taobao.org/mirrors/sharp-libvips"
PS C:\\Users\\xxx-api> npm install sharp
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: styled-components@5.3.3
npm WARN Found: react-is@17.0.2
npm WARN node_modules/styled-components/node_modules/react-is
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react-is@">= 16.8.0" from styled-components@5.3.3
npm WARN node_modules/styled-components
npm WARN   peer styled-components@">= 2" from babel-plugin-styled-components@2.1.1
npm WARN   node_modules/styled-components/node_modules/babel-plugin-styled-components
npm WARN   8 more (babel-plugin-styled-components, ...)
npm ERR! code 1
npm ERR! path C:\\Users\\xxx-api\\node_modules\\sharp
npm ERR! command failed
npm ERR! command C:\\Windows\\system32\\cmd.exe /d /s /c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm ERR! sharp: Downloading https://npm.taobao.org/mirrors/sharp-libvips/v8.14.2/libvips-8.14.2-win32-x64.tar.br
npm ERR! sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
npm ERR! sharp: Installation error: self signed certificate in certificate chain

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\\Users\\Jindi J Sun\\AppData\\Local\\npm-cache\\_logs\\2023-04-07T07_39_48_839Z-debug-0.log
PS C:\\Users\\xxx-api> yarn config set sharp_binary_host "https://npm.taobao.org/mirrors/sharp"
yarn config v1.22.19
success Set "sharp_binary_host" to "https://npm.taobao.org/mirrors/sharp".
Done in 0.06s.
PS C:\\Users\\xxx-api> yarn config set sharp_libvips_binary_host "https://npm.taobao.org/mirrors/sharp-libvips"
yarn config v1.22.19
success Set "sharp_libvips_binary_host" to "https://npm.taobao.org/mirrors/sharp-libvips".
Done in 0.06s.
PS C:\\Users\\xxx-api> yarn add sharp
yarn add v1.22.19
info No lockfile found.
[1/5] Validating package.json...
[2/5] Resolving packages...
warning @strapi/strapi > koa-body > formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
warning @strapi/strapi > @strapi/plugin-email > @strapi/provider-email-sendmail > sendmail > mailcomposer@3.12.0: This project is unmaintained
warning @strapi/strapi > @strapi/plugin-email > @strapi/provider-email-sendmail > sendmail > mailcomposer > buildmail@3.10.0: This project is unmaintained
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
[3/5] Fetching packages...
[4/5] Linking dependencies...
warning "@strapi/strapi > @strapi/plugin-content-type-builder@4.9.0" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-content-type-builder@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-content-type-builder@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning "@strapi/strapi > @strapi/plugin-content-type-builder@4.9.0" has unmet peer dependency "styled-components@5.3.3".
warning "@strapi/strapi > @strapi/plugin-email@4.9.0" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-email@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-email@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning "@strapi/strapi > @strapi/plugin-email@4.9.0" has unmet peer dependency "styled-components@5.3.3".
warning "@strapi/strapi > @strapi/plugin-upload@4.9.0" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-upload@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-upload@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning "@strapi/strapi > @strapi/plugin-upload@4.9.0" has unmet peer dependency "styled-components@5.3.3".
warning "@strapi/plugin-users-permissions > @strapi/design-system@1.6.6" has unmet peer dependency "react@^17.0.1".
warning "@strapi/plugin-users-permissions > @strapi/design-system@1.6.6" has unmet peer dependency "react-dom@^17.0.1".
warning "@strapi/plugin-users-permissions > @strapi/design-system@1.6.6" has unmet peer dependency "react-router-dom@^5.2.0".
warning "@strapi/plugin-users-permissions > @strapi/design-system@1.6.6" has unmet peer dependency "styled-components@^5.2.1".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > react-helmet@6.1.0" has unmet peer dependency "react@>=16.3.0".
warning "@strapi/plugin-users-permissions > @strapi/icons@1.6.6" has unmet peer dependency "react@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/icons@1.6.6" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/helper-plugin@4.9.0" has unmet peer dependency "react@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/helper-plugin@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/helper-plugin@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning "@strapi/plugin-users-permissions > @strapi/helper-plugin@4.9.0" has unmet peer dependency "styled-components@5.3.3".
warning "@strapi/plugin-users-permissions > react-redux@8.0.5" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
warning "@strapi/plugin-users-permissions > react-intl@6.3.2" has unmet peer dependency "react@^16.6.0 || 17 || 18".
warning "@strapi/plugin-users-permissions > formik@2.2.9" has unmet peer dependency "react@>=16.8.0".
warning "@strapi/plugin-users-permissions > react-query@3.24.3" has unmet peer dependency "react@^16.8.0 || ^17.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @floating-ui/react-dom@1.3.0" has unmet peer dependency "react@>=16.8.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @floating-ui/react-dom@1.3.0" has unmet peer dependency "react-dom@>=16.8.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror@4.19.11" has unmet peer dependency "@babel/runtime@>=7.11.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror@4.19.11" has unmet peer dependency "@codemirror/state@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror@4.19.11" has unmet peer dependency "@codemirror/theme-one-dark@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror@4.19.11" has unmet peer dependency "@codemirror/view@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror@4.19.11" has unmet peer dependency "codemirror@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror@4.19.11" has unmet peer dependency "react@>=16.8.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror@4.19.11" has unmet peer dependency "react-dom@>=16.8.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @radix-ui/react-use-callback-ref@1.0.0" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > react-helmet > react-side-effect@2.1.2" has unmet peer dependency "react@^16.3.0 || ^17.0.0 || ^18.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > react-redux > use-sync-external-store@1.2.0" has unmet peer dependency "react@^16.8.0 || ^17.0.0 || ^18.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.19.11" has unmet peer dependency "@codemirror/autocomplete@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.19.11" has unmet peer dependency "@codemirror/language@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.19.11" has unmet peer dependency "@codemirror/lint@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.19.11" has unmet peer dependency "@codemirror/search@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.19.11" has unmet peer dependency "@codemirror/view@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror > codemirror > @codemirror/autocomplete@6.4.2" has unmet peer dependency "@lezer/common@^1.0.0".
warning " > @strapi/plugin-users-permissions@4.9.0" has unmet peer dependency "react@^17.0.2".
warning " > @strapi/plugin-users-permissions@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning " > @strapi/plugin-users-permissions@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning " > @strapi/plugin-users-permissions@4.9.0" has unmet peer dependency "styled-components@5.3.3".
warning " > @strapi/plugin-i18n@4.9.0" has unmet peer dependency "react@^17.0.2".
warning " > @strapi/plugin-i18n@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning " > @strapi/plugin-i18n@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning " > @strapi/plugin-i18n@4.9.0" has unmet peer dependency "styled-components@5.3.3".
[5/5] Building fresh packages...
[-/6] ⡀ waiting...
[6/6] ⡀ sharp
[3/6] ⡀ sharp
[-/6] ⢀ waiting...
error C:\\Users\\xxx-api\\node_modules\\@strapi\\plugin-upload\\node_modules\\sharp: Command failed.
Exit code: 1
Command: (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
Arguments:
Directory: C:\\Users\\xxx-api\\node_modules\\@strapi\\plugin-upload\\node_modules\\sharp
Output:




PS C:cd C:\\Users\\xxx-api && yarn install

yarn install v1.22.19un\\Documents\\my_files\\A-Web-Project\\service-categories\\service-categories-api> cd .\\service-categories-api\\
info No lockfile found.
[1/5] Validating package.json...
[2/5] Resolving packages...
warning @strapi/strapi > koa-body > formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
warning @strapi/strapi > @strapi/plugin-email > @strapi/provider-email-sendmail > sendmail > mailcomposer@3.12.0: This project is unmaintained
warning @strapi/strapi > @strapi/plugin-email > @strapi/provider-email-sendmail > sendmail > mailcomposer > buildmail@3.10.0: This project is unmaintained
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
[3/5] Fetching packages...
[4/5] Linking dependencies...
warning "@strapi/strapi > @strapi/plugin-email@4.9.0" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-email@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-email@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning "@strapi/strapi > @strapi/plugin-email@4.9.0" has unmet peer dependency "styled-components@5.3.3".
warning "@strapi/strapi > @strapi/plugin-content-type-builder@4.9.0" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-content-type-builder@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-content-type-builder@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning "@strapi/strapi > @strapi/plugin-content-type-builder@4.9.0" has unmet peer dependency "styled-components@5.3.3".
warning "@strapi/strapi > @strapi/plugin-upload@4.9.0" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-upload@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-upload@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning "@strapi/strapi > @strapi/plugin-upload@4.9.0" has unmet peer dependency "styled-components@5.3.3".
warning "@strapi/plugin-users-permissions > @strapi/design-system@1.6.6" has unmet peer dependency "react@^17.0.1".
warning "@strapi/plugin-users-permissions > @strapi/design-system@1.6.6" has unmet peer dependency "react-dom@^17.0.1".
warning "@strapi/plugin-users-permissions > @strapi/design-system@1.6.6" has unmet peer dependency "react-router-dom@^5.2.0".
warning "@strapi/plugin-users-permissions > @strapi/design-system@1.6.6" has unmet peer dependency "styled-components@^5.2.1".
warning "@strapi/plugin-users-permissions > @strapi/helper-plugin@4.9.0" has unmet peer dependency "react@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/helper-plugin@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/helper-plugin@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning "@strapi/plugin-users-permissions > @strapi/helper-plugin@4.9.0" has unmet peer dependency "styled-components@5.3.3".
warning "@strapi/plugin-users-permissions > @strapi/icons@1.6.6" has unmet peer dependency "react@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/icons@1.6.6" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/plugin-users-permissions > formik@2.2.9" has unmet peer dependency "react@>=16.8.0".
warning "@strapi/plugin-users-permissions > react-intl@6.3.2" has unmet peer dependency "react@^16.6.0 || 17 || 18".
warning "@strapi/plugin-users-permissions > react-query@3.24.3" has unmet peer dependency "react@^16.8.0 || ^17.0.0".
warning "@strapi/plugin-users-permissions > react-redux@8.0.5" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror@4.19.11" has unmet peer dependency "@codemirror/state@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror@4.19.11" has unmet peer dependency "@codemirror/theme-one-dark@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror@4.19.11" has unmet peer dependency "@codemirror/view@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror@4.19.11" has unmet peer dependency "codemirror@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.19.11" has unmet peer dependency "@codemirror/autocomplete@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.19.11" has unmet peer dependency "@codemirror/language@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.19.11" has unmet peer dependency "@codemirror/lint@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.19.11" has unmet peer dependency "@codemirror/search@>=6.0.0".warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.19.11" has unmet peer dependency "@codemirror/view@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > codemirror > @codemirror/autocomplete@6.4.2" has unmet peer dependency "@lezer/common@^1.0.0".
warning " > @strapi/plugin-users-permissions@4.9.0" has unmet peer dependency "react@^17.0.2".
warning " > @strapi/plugin-users-permissions@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning " > @strapi/plugin-users-permissions@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning " > @strapi/plugin-users-permissions@4.9.0" has unmet peer dependency "styled-components@5.3.3".
warning " > @strapi/plugin-i18n@4.9.0" has unmet peer dependency "react@^17.0.2".
warning " > @strapi/plugin-i18n@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning " > @strapi/plugin-i18n@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning " > @strapi/plugin-i18n@4.9.0" has unmet peer dependency "styled-components@5.3.3".
[5/5] Building fresh packages...
[-/5] ⠄ waiting...
[-/5] ⡀ waiting...
[3/5] ⡀ sharp
[-/5] ⡀ waiting...
error C:\\Users\\xxx-api\\node_modules\\sharp: Command failed.
Exit code: 1
Command: (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
Arguments:
Directory: C:\\Users\\xxx-api\\node_modules\\sharp
Output:




PS C:\\Users\\xxx-api> node install/libvips && node install/dll-copy && prebuild-install
At line:1 char:22
+ node install/libvips && node install/dll-copy && prebuild-install
+                      ~~
The token \'&&\' is not a valid statement separator in this version.
At line:1 char:47
+ node install/libvips && node install/dll-copy && prebuild-install
+                                               ~~
The token \'&&\' is not a valid statement separator in this version.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : InvalidEndOfLine

PS C:\\Users\\xxx-api> npm config set sharp_binary_host "https://npm.taobao.org/mirrors/sharp"
PS C:\\Users\\xxx-api> npm config set sharp_libvips_binary_host "https://npm.taobao.org/mirrors/sharp-libvips"
PS C:\\Users\\xxx-api> npm install sharp
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: styled-components@5.3.3
npm WARN Found: react-is@17.0.2
npm WARN node_modules/styled-components/node_modules/react-is
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react-is@">= 16.8.0" from styled-components@5.3.3
npm WARN node_modules/styled-components
npm WARN   peer styled-components@">= 2" from babel-plugin-styled-components@2.1.1
npm WARN   node_modules/styled-components/node_modules/babel-plugin-styled-components
npm WARN   8 more (babel-plugin-styled-components, ...)
npm ERR! code 1
npm ERR! path C:\\Users\\xxx-api\\node_modules\\sharp
npm ERR! command failed
npm ERR! command C:\\Windows\\system32\\cmd.exe /d /s /c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm ERR! sharp: Downloading https://npm.taobao.org/mirrors/sharp-libvips/v8.14.2/libvips-8.14.2-win32-x64.tar.br
npm ERR! sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
npm ERR! sharp: Installation error: self signed certificate in certificate chain

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\\Users\\Jindi J Sun\\AppData\\Local\\npm-cache\\_logs\\2023-04-07T07_39_48_839Z-debug-0.log
PS C:\\Users\\xxx-api> yarn config set sharp_binary_host "https://npm.taobao.org/mirrors/sharp"
yarn config v1.22.19
success Set "sharp_binary_host" to "https://npm.taobao.org/mirrors/sharp".
Done in 0.06s.
PS C:\\Users\\xxx-api> yarn config set sharp_libvips_binary_host "https://npm.taobao.org/mirrors/sharp-libvips"
yarn config v1.22.19
success Set "sharp_libvips_binary_host" to "https://npm.taobao.org/mirrors/sharp-libvips".
Done in 0.06s.
PS C:\\Users\\xxx-api> yarn add sharp
yarn add v1.22.19
info No lockfile found.
[1/5] Validating package.json...
[2/5] Resolving packages...
warning @strapi/strapi > koa-body > formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
warning @strapi/strapi > @strapi/plugin-email > @strapi/provider-email-sendmail > sendmail > mailcomposer@3.12.0: This project is unmaintained
warning @strapi/strapi > @strapi/plugin-email > @strapi/provider-email-sendmail > sendmail > mailcomposer > buildmail@3.10.0: This project is unmaintained
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
[3/5] Fetching packages...
[4/5] Linking dependencies...
warning "@strapi/strapi > @strapi/plugin-content-type-builder@4.9.0" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-content-type-builder@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-content-type-builder@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning "@strapi/strapi > @strapi/plugin-content-type-builder@4.9.0" has unmet peer dependency "styled-components@5.3.3".
warning "@strapi/strapi > @strapi/plugin-email@4.9.0" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-email@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-email@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning "@strapi/strapi > @strapi/plugin-email@4.9.0" has unmet peer dependency "styled-components@5.3.3".
warning "@strapi/strapi > @strapi/plugin-upload@4.9.0" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-upload@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/plugin-upload@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning "@strapi/strapi > @strapi/plugin-upload@4.9.0" has unmet peer dependency "styled-components@5.3.3".
warning "@strapi/plugin-users-permissions > @strapi/design-system@1.6.6" has unmet peer dependency "react@^17.0.1".
warning "@strapi/plugin-users-permissions > @strapi/design-system@1.6.6" has unmet peer dependency "react-dom@^17.0.1".
warning "@strapi/plugin-users-permissions > @strapi/design-system@1.6.6" has unmet peer dependency "react-router-dom@^5.2.0".
warning "@strapi/plugin-users-permissions > @strapi/design-system@1.6.6" has unmet peer dependency "styled-components@^5.2.1".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > react-helmet@6.1.0" has unmet peer dependency "react@>=16.3.0".
warning "@strapi/plugin-users-permissions > @strapi/icons@1.6.6" has unmet peer dependency "react@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/icons@1.6.6" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/helper-plugin@4.9.0" has unmet peer dependency "react@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/helper-plugin@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/helper-plugin@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning "@strapi/plugin-users-permissions > @strapi/helper-plugin@4.9.0" has unmet peer dependency "styled-components@5.3.3".
warning "@strapi/plugin-users-permissions > react-redux@8.0.5" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
warning "@strapi/plugin-users-permissions > react-intl@6.3.2" has unmet peer dependency "react@^16.6.0 || 17 || 18".
warning "@strapi/plugin-users-permissions > formik@2.2.9" has unmet peer dependency "react@>=16.8.0".
warning "@strapi/plugin-users-permissions > react-query@3.24.3" has unmet peer dependency "react@^16.8.0 || ^17.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @floating-ui/react-dom@1.3.0" has unmet peer dependency "react@>=16.8.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @floating-ui/react-dom@1.3.0" has unmet peer dependency "react-dom@>=16.8.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror@4.19.11" has unmet peer dependency "@babel/runtime@>=7.11.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror@4.19.11" has unmet peer dependency "@codemirror/state@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror@4.19.11" has unmet peer dependency "@codemirror/theme-one-dark@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror@4.19.11" has unmet peer dependency "@codemirror/view@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror@4.19.11" has unmet peer dependency "codemirror@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror@4.19.11" has unmet peer dependency "react@>=16.8.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror@4.19.11" has unmet peer dependency "react-dom@>=16.8.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @radix-ui/react-use-callback-ref@1.0.0" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > react-helmet > react-side-effect@2.1.2" has unmet peer dependency "react@^16.3.0 || ^17.0.0 || ^18.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > react-redux > use-sync-external-store@1.2.0" has unmet peer dependency "react@^16.8.0 || ^17.0.0 || ^18.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.19.11" has unmet peer dependency "@codemirror/autocomplete@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.19.11" has unmet peer dependency "@codemirror/language@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.19.11" has unmet peer dependency "@codemirror/lint@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.19.11" has unmet peer dependency "@codemirror/search@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror > @uiw/codemirror-extensions-basic-setup@4.19.11" has unmet peer dependency "@codemirror/view@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror > codemirror > @codemirror/autocomplete@6.4.2" has unmet peer dependency "@lezer/common@^1.0.0".
warning " > @strapi/plugin-users-permissions@4.9.0" has unmet peer dependency "react@^17.0.2".
warning " > @strapi/plugin-users-permissions@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning " > @strapi/plugin-users-permissions@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning " > @strapi/plugin-users-permissions@4.9.0" has unmet peer dependency "styled-components@5.3.3".
warning " > @strapi/plugin-i18n@4.9.0" has unmet peer dependency "react@^17.0.2".
warning " > @strapi/plugin-i18n@4.9.0" has unmet peer dependency "react-dom@^17.0.2".
warning " > @strapi/plugin-i18n@4.9.0" has unmet peer dependency "react-router-dom@5.3.4".
warning " > @strapi/plugin-i18n@4.9.0" has unmet peer dependency "styled-components@5.3.3".
[5/5] Building fresh packages...
[-/6] ⡀ waiting...
[6/6] ⡀ sharp
[3/6] ⡀ sharp
[-/6] ⢀ waiting...
error C:\\Users\\xxx-api\\node_modules\\@strapi\\plugin-upload\\node_modules\\sharp: Command failed.
Exit code: 1
Command: (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
Arguments:
Directory: C:\\Users\\xxx-api\\node_modules\\@strapi\\plugin-upload\\node_modules\\sharp
Output:
PS C:\\Users\\xxx-api>>

解决方案:

    1. 使用靠靠谱的网络
    1. 在项目目录下配置.yarnrc(或者.npmrc文件)
registry "https://registry.npm.taobao.org"
sass_binary_site "https://npm.taobao.org/mirrors/node-sass/"
phantomjs_cdnurl "http://cnpmjs.org/downloads"
electron_mirror "https://npm.taobao.org/mirrors/electron/"
sqlite3_binary_host_mirror "https://foxgis.oss-cn-shanghai.aliyuncs.com/"
profiler_binary_host_mirror "https://npm.taobao.org/mirrors/node-inspector/"
chromedriver_cdnurl "https://cdn.npm.taobao.org/dist/chromedriver"
sharp_binary_host "https://npm.taobao.org/mirrors/sharp"
sharp_libvips_binary_host "https://npm.taobao.org/mirrors/sharp-libvips"

执行命令,成功安装

yarn install

今天就写到这里啦~

  • 小伙伴们,( ̄ω ̄( ̄ω ̄〃 ( ̄ω ̄〃)ゝ我们明天再见啦~~
  • 大家要天天开心哦

欢迎大家指出文章需要改正之处~
学无止境,合作共赢

欢迎路过的小哥哥小姐姐们提出更好的意见哇~~

MAC M1 安装“sharp”模块出现问题

【中文标题】MAC M1 安装“sharp”模块出现问题【英文标题】:MAC M1 Something went wrong installing the "sharp" module 【发布时间】:2021-08-06 03:44:44 【问题描述】:

在带有 Error: Something went wrong installing the "sharp" module 的 MacBook Pro M1 芯片出口上运行 npm run dev (gatsby develop)

运行npm run dev MacBook Pro 英特尔芯片工作正常。

我看过类似的帖子,但没有解决我的问题:

When i run "gatsby develop " Something went wrong installing the "sharp" module error is showing Error Installing Gatsby Starter 'Something went wrong installing the "sharp" module' Gatsby Develop : Something went wrong installing the "sharp" module

我已经更新了我的节点版本以防任何修复,但我仍然在node v16.0.0 上收到错误

在这个github issue 上,他们建议按照这些不起作用的步骤进行操作。

rm -r node_modules/sharp
yarn install --check-files

在这个github issue 上,他们建议安装NVM 并降级节点版本。 NVM 在我的 M1 芯片上安装有些困难,所以它对我来说不是一个好的选择。

我也尝试过以下步骤,但效果不佳

rm -rf node_module
rm package-lock.json
npm i 

知道我可以做些什么来让gatsby develop 在 M1 芯片上简单地工作吗?

【问题讨论】:

【参考方案1】:

按照this issue 的这些步骤解决了我的问题。

    xcode-select --install brew install gcc brew reinstall vips brew info vips npm i

然后你可以运行gatsby develop

【讨论】:

【参考方案2】:

我不得不从 17 降级节点(nvm 在这里是理想的) - 它在 14 上工作。

【讨论】:

【参考方案3】:

我试过这个命令,它可能也适合你。 您需要做的就是使用不安全的烫发安装Sharp,这将修复错误

npm install sharp --unsafe-perm

请记住,这只是暂时修复它,我建议您更新主要修复的 xcode 命令行工具

【讨论】:

这对我有用。不错的解决方案!

以上是关于解决前端安装sharp出错问题sharp: Command failed.的主要内容,如果未能解决你的问题,请参考以下文章

使用 Nodejs Sharp 模块时出错。模块解析失败:意外字符 '' (1: 0)

如何修复安装“sharp”模块时出现问题,在 expo 中找不到模块 '../build/Release/sharp.node'

我无法使用 npm 安装Sharp

在 AWS Lambda 函数中运行 Sharp 时出错:darwin-x64' 二进制文件不能在 'linux-x64' 平台上使用

MAC M1 安装“sharp”模块出现问题

nodejs处理图片工具sharp