node.js - Gatsby 默认启动器
问题描述
我创建gatsby-default-starter
网站时出现此错误。如何解决它。它有什么问题?
错误信息:
‼ pngquant pre-build test failed i compiling from source × Error: pngquant failed to build, make sure that libpng-dev is installed at D:\gatsby-project\my-gatsby-project\node_modules\bin-build\node_modules\execa\index.js:231:11 at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:93:5) at async Promise.all (index 0) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! pngquant-bin@6.0.0 postinstall: node lib/install.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the pngquant-bin@6.0.0 postinstall script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
ERROR
Command failed with exit code 1: npm install
Error: Command failed with exit code 1: npm install
error.js:56 makeError [npm]/[gatsby-cli]/[execa]/lib/error.js:56:11
index.js:114 handlePromise [npm]/[gatsby-cli]/[execa]/index.js:114:26
task_queues.js:93 processTicksAndRejections internal/process/task_queues.js:93:5
init-starter.js:135 install [npm]/[gatsby-cli]/lib/init-starter.js:135:7
init-starter.js:202 clone [npm]/[gatsby-cli]/lib/init-starter.js:202:3
init-starter.js:343 initStarter [npm]/[gatsby-cli]/lib/init-starter.js:343:5
create-cli.js:494 [npm]/[gatsby-cli]/lib/create-cli.js:494:9
解决方案
看来您正在使用 Windows 作为操作系统。此问题通常与您可能需要的一些其他依赖项有关。尝试以下操作:
删除您的项目(以避免可能损坏的依赖项)。
通过以下方式安装
windows-build-tools
:npm install --global windows-build-tools --vs2015
运行您的启动命令并开发它。例如:
npm install -g gatsby-cli gatsby new gatsby-site cd gatsby-site gatsby develop
如果问题仍然存在,请尝试通过以下方式手动安装缺少的依赖项:
npm install imagemin-pngquant@5.0.1 --save npm install pngquant-bin@3.1.1 --save
有关更多详细信息,请查看Windows 文档上的 Gatsby。
推荐阅读
- javascript - 为什么 react render 接受一个块而 return 不接受?
- sparql - 如何列出自定义 Wikibase 实例上的所有属性
- moodle - 根据用户角色创建 CSS 类
- java - java中的arraylist,打印出所有数据
- youtube-api - 使用 Youtube Data API 使我的视频在上传时成为私密视频
- c# - 输入字符串的格式不正确 - 传递 NULL 值时
- html - WebStorm - 实时模板 - Twig + Html 不起作用
- reactjs - 如何删除 React Navigation 5 中每个选项卡屏幕的标题?
- kubernetes - 微服务 API 网关和 Identity Server 4 kubernates
- php - localhost:xxxx 数据库连接更改为 TCP/IP?