0


解决前端安装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 > [email protected]: 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 > [email protected]: This project is unmaintained
warning @strapi/strapi > @strapi/plugin-email > @strapi/provider-email-sendmail > sendmail > mailcomposer > [email protected]: This project is unmaintained
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > [email protected]: Please see https://github.com/lydell/urix#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > [email protected]: https://github.com/lydell/resolve-url#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > [email protected]: See https://github.com/lydell/source-map-url#deprecated
[3/5] Fetching packages...
[4/5] Linking dependencies...
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react@^17.0.1".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.1".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react-router-dom@^5.2.0".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "styled-components@^5.2.1".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/plugin-users-permissions > [email protected]" has unmet peer dependency "react@>=16.8.0".
warning "@strapi/plugin-users-permissions > [email protected]" has unmet peer dependency "react@^16.6.0 || 17 || 18".
warning "@strapi/plugin-users-permissions > [email protected]" has unmet peer dependency "react@^16.8.0 || ^17.0.0".
warning "@strapi/plugin-users-permissions > [email protected]" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/[email protected]" has unmet peer dependency "@codemirror/state@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/[email protected]" has unmet peer dependency "@codemirror/theme-one-dark@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/[email protected]" has unmet peer dependency "@codemirror/view@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/[email protected]" has unmet peer dependency "codemirror@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > @uiw/[email protected]" has unmet peer dependency "@codemirror/autocomplete@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > @uiw/[email protected]" has unmet peer dependency "@codemirror/language@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > @uiw/[email protected]" has unmet peer dependency "@codemirror/lint@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > @uiw/[email protected]" has unmet peer dependency "@codemirror/search@>=6.0.0".warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > @uiw/[email protected]" has unmet peer dependency "@codemirror/view@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > codemirror > @codemirror/[email protected]" has unmet peer dependency "@lezer/common@^1.0.0".
warning " > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning " > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning " > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning " > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning " > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning " > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning " > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning " > @strapi/[email protected]" has unmet peer dependency "[email protected]".
[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: [email protected]
npm WARN Found: [email protected]
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 [email protected]
npm WARN node_modules/styled-components
npm WARN   peer styled-components@">= 2" from [email protected]
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 > [email protected]: 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 > [email protected]: This project is unmaintained
warning @strapi/strapi > @strapi/plugin-email > @strapi/provider-email-sendmail > sendmail > mailcomposer > [email protected]: This project is unmaintained
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > [email protected]: https://github.com/lydell/resolve-url#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > [email protected]: See https://github.com/lydell/source-map-url#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > [email protected]: Please see https://github.com/lydell/urix#deprecated
[3/5] Fetching packages...
[4/5] Linking dependencies...
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react@^17.0.1".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.1".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react-router-dom@^5.2.0".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "styled-components@^5.2.1".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > [email protected]" has unmet peer dependency "react@>=16.3.0".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/plugin-users-permissions > [email protected]" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
warning "@strapi/plugin-users-permissions > [email protected]" has unmet peer dependency "react@^16.6.0 || 17 || 18".
warning "@strapi/plugin-users-permissions > [email protected]" has unmet peer dependency "react@>=16.8.0".
warning "@strapi/plugin-users-permissions > [email protected]" has unmet peer dependency "react@^16.8.0 || ^17.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @floating-ui/[email protected]" has unmet peer dependency "react@>=16.8.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @floating-ui/[email protected]" has unmet peer dependency "react-dom@>=16.8.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/[email protected]" has unmet peer dependency "@babel/runtime@>=7.11.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/[email protected]" has unmet peer dependency "@codemirror/state@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/[email protected]" has unmet peer dependency "@codemirror/theme-one-dark@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/[email protected]" has unmet peer dependency "@codemirror/view@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/[email protected]" has unmet peer dependency "codemirror@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/[email protected]" has unmet peer dependency "react@>=16.8.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/[email protected]" has unmet peer dependency "react-dom@>=16.8.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @radix-ui/[email protected]" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > react-helmet > [email protected]" has unmet peer dependency "react@^16.3.0 || ^17.0.0 || ^18.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > react-redux > [email protected]" 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/[email protected]" has unmet peer dependency "@codemirror/autocomplete@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror > @uiw/[email protected]" has unmet peer dependency "@codemirror/language@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror > @uiw/[email protected]" has unmet peer dependency "@codemirror/lint@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror > @uiw/[email protected]" has unmet peer dependency "@codemirror/search@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror > @uiw/[email protected]" 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/[email protected]" has unmet peer dependency "@lezer/common@^1.0.0".
warning " > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning " > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning " > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning " > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning " > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning " > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning " > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning " > @strapi/[email protected]" has unmet peer dependency "[email protected]".
[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 > [email protected]: 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 > [email protected]: This project is unmaintained
warning @strapi/strapi > @strapi/plugin-email > @strapi/provider-email-sendmail > sendmail > mailcomposer > [email protected]: This project is unmaintained
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > [email protected]: Please see https://github.com/lydell/urix#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > [email protected]: https://github.com/lydell/resolve-url#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > [email protected]: See https://github.com/lydell/source-map-url#deprecated
[3/5] Fetching packages...
[4/5] Linking dependencies...
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react@^17.0.1".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.1".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react-router-dom@^5.2.0".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "styled-components@^5.2.1".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/plugin-users-permissions > [email protected]" has unmet peer dependency "react@>=16.8.0".
warning "@strapi/plugin-users-permissions > [email protected]" has unmet peer dependency "react@^16.6.0 || 17 || 18".
warning "@strapi/plugin-users-permissions > [email protected]" has unmet peer dependency "react@^16.8.0 || ^17.0.0".
warning "@strapi/plugin-users-permissions > [email protected]" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/[email protected]" has unmet peer dependency "@codemirror/state@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/[email protected]" has unmet peer dependency "@codemirror/theme-one-dark@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/[email protected]" has unmet peer dependency "@codemirror/view@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/[email protected]" has unmet peer dependency "codemirror@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > @uiw/[email protected]" has unmet peer dependency "@codemirror/autocomplete@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > @uiw/[email protected]" has unmet peer dependency "@codemirror/language@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > @uiw/[email protected]" has unmet peer dependency "@codemirror/lint@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > @uiw/[email protected]" has unmet peer dependency "@codemirror/search@>=6.0.0".warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > @uiw/[email protected]" has unmet peer dependency "@codemirror/view@>=6.0.0".
warning "@strapi/strapi > @strapi/admin > @strapi/design-system > @uiw/react-codemirror > codemirror > @codemirror/[email protected]" has unmet peer dependency "@lezer/common@^1.0.0".
warning " > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning " > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning " > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning " > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning " > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning " > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning " > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning " > @strapi/[email protected]" has unmet peer dependency "[email protected]".
[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: [email protected]
npm WARN Found: [email protected]
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 [email protected]
npm WARN node_modules/styled-components
npm WARN   peer styled-components@">= 2" from [email protected]
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 > [email protected]: 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 > [email protected]: This project is unmaintained
warning @strapi/strapi > @strapi/plugin-email > @strapi/provider-email-sendmail > sendmail > mailcomposer > [email protected]: This project is unmaintained
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > [email protected]: https://github.com/lydell/resolve-url#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > [email protected]: See https://github.com/lydell/source-map-url#deprecated
warning @strapi/strapi > @strapi/generators > plop > liftoff > findup-sync > micromatch > snapdragon > source-map-resolve > [email protected]: Please see https://github.com/lydell/urix#deprecated
[3/5] Fetching packages...
[4/5] Linking dependencies...
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/strapi > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react@^17.0.1".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.1".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react-router-dom@^5.2.0".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "styled-components@^5.2.1".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > [email protected]" has unmet peer dependency "react@>=16.3.0".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/plugin-users-permissions > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning "@strapi/plugin-users-permissions > [email protected]" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
warning "@strapi/plugin-users-permissions > [email protected]" has unmet peer dependency "react@^16.6.0 || 17 || 18".
warning "@strapi/plugin-users-permissions > [email protected]" has unmet peer dependency "react@>=16.8.0".
warning "@strapi/plugin-users-permissions > [email protected]" has unmet peer dependency "react@^16.8.0 || ^17.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @floating-ui/[email protected]" has unmet peer dependency "react@>=16.8.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @floating-ui/[email protected]" has unmet peer dependency "react-dom@>=16.8.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/[email protected]" has unmet peer dependency "@babel/runtime@>=7.11.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/[email protected]" has unmet peer dependency "@codemirror/state@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/[email protected]" has unmet peer dependency "@codemirror/theme-one-dark@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/[email protected]" has unmet peer dependency "@codemirror/view@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/[email protected]" has unmet peer dependency "codemirror@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/[email protected]" has unmet peer dependency "react@>=16.8.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/[email protected]" has unmet peer dependency "react-dom@>=16.8.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @radix-ui/[email protected]" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > react-helmet > [email protected]" has unmet peer dependency "react@^16.3.0 || ^17.0.0 || ^18.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > react-redux > [email protected]" 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/[email protected]" has unmet peer dependency "@codemirror/autocomplete@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror > @uiw/[email protected]" has unmet peer dependency "@codemirror/language@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror > @uiw/[email protected]" has unmet peer dependency "@codemirror/lint@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror > @uiw/[email protected]" has unmet peer dependency "@codemirror/search@>=6.0.0".
warning "@strapi/strapi > @strapi/plugin-content-type-builder > @strapi/design-system > @uiw/react-codemirror > @uiw/[email protected]" 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/[email protected]" has unmet peer dependency "@lezer/common@^1.0.0".
warning " > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning " > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning " > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning " > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning " > @strapi/[email protected]" has unmet peer dependency "react@^17.0.2".
warning " > @strapi/[email protected]" has unmet peer dependency "react-dom@^17.0.2".
warning " > @strapi/[email protected]" has unmet peer dependency "[email protected]".
warning " > @strapi/[email protected]" has unmet peer dependency "[email protected]".
[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

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

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

在这里插入图片描述

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

标签: 前端 javascript npm

本文转载自: https://blog.csdn.net/tangdou369098655/article/details/130120284
版权归原作者 tangdou369098655 所有, 如有侵权,请联系我们删除。

“解决前端安装sharp出错问题sharp: Command failed.”的评论:

还没有评论