Code Monkey home page Code Monkey logo

wallhavenexplorer's Introduction

wallhavenExplorer

npm install
npm install puppeteer

遇到安装 Puppeteer 时出现网络问题导致的错误是相对常见的情况,以下是一些可能的解决方案:

1. 设置环境变量跳过下载

如果你已经有了 Chromium 或 Chrome 的本地安装,你可以设置环境变量 PUPPETEER_SKIP_DOWNLOAD 来跳过下载过程。这可以通过在命令行中设置环境变量来实现:

  • Windows (命令行):

    set PUPPETEER_SKIP_DOWNLOAD=true
    npm install puppeteer
  • Windows (PowerShell):

    $env:PUPPETEER_SKIP_DOWNLOAD="true"
    npm install puppeteer

注意:跳过下载意味着你需要手动指定 Chromium 或 Chrome 的执行路径。你可以在启动 Puppeteer 时通过 executablePath 选项来指定:

const browser = await puppeteer.launch({
  executablePath: '/path/to/your/Chrome'
});

2. 使用代理或VPN

如果你处于网络受限环境(例如,某些资源在国内访问受限),尝试使用 VPN 或代理来访问互联网。

3. 使用 cnpm 安装

在**大陆,可以使用淘宝 NPM 镜像(cnpm)来加速依赖的安装。首先安装 cnpm:

npm install -g cnpm --registry=https://registry.npm.taobao.org

然后使用 cnpm 来安装 Puppeteer:

cnpm install puppeteer

4. 手动下载并指定 Chromium

  1. 手动下载 Chromium 并解压到你的项目中或任何你喜欢的位置。

  2. 指定 executablePath:在你的 Puppeteer 脚本中指定下载的 Chromium 执行文件的路径。例如:

    Copy codeconst browser = await puppeteer.launch({
      executablePath: 'path/to/your/Chromium'
    });

wallhavenexplorer's People

Contributors

kp1nz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.