简体   繁体   中英

Gatsby fails at develop when cloning git repository

My gatsby project works perfectly when I create new project and follow these steps: https://www.gatsbyjs.com/docs/quick-start/ But when I try to clone another repository such as:

  1. git clone https://repositoryurl
  2. npm install -g gatsby-cli
  3. npm install
  4. gatsby develop

It fails with error Failed at the pngquant-bin@5.0.2 postinstall script. I tried different repositories, all the solutions which I found on internet but nothing helps. Before you ask running npm install libpng-dev gives npm ERR! 404 Not Found - GET https://registry.npmjs.org/libpng-dev - Not found npm ERR! 404 Not Found - GET https://registry.npmjs.org/libpng-dev - Not found . Running npm install pngquant-bin gives npm ERR! pngquant-bin@6.0.0 postinstall node lib/install.js npm ERR! pngquant-bin@6.0.0 postinstall node lib/install.js My node version: v12.18.3 . My npm version: 6.14.6 . I use Windows 10 .

You need to install windows-build-tools . Just run:

npm install --global windows-build-tools --vs2015

Many Gatsby plugins and themes require building native Node.js modules, eg Sharp (a common Gatsby dependency used for image processing, like the one breaking your code). Upon installing this package, it downloads and installs Visual C++ Build Tools 2015, provided free of charge by Microsoft. These tools are required to compile popular native modules. It will also install Python 2.7, configuring your machine, and npm appropriately.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM