我试过这个:
puppeteer.launch({
env: {
TZ: 'Australia/Melbourne',
...process.env
}
});
Run Code Online (Sandbox Code Playgroud)
别为我工作。whoer.net 看到我的实际系统时间。
编辑:有关https://github.com/nodejs/node/issues/4230的一些信息
此代码在 Linux 上运行良好,但在 Windows 上不起作用:
process.env.TZ = 'UTC';
console.log(new Date());
Run Code Online (Sandbox Code Playgroud)
在 Windows 上,我从操作系统中看到时区。
javascript google-chrome node.js google-chrome-devtools puppeteer
我是puppeteer和docker的新手。我在docker容器中以headful模式设置人偶时遇到问题。
Puppeteer version: 1.6.2 Platform / OS version: Docker node:8-slim Node.js version: node 8
Run Code Online (Sandbox Code Playgroud)
DockerFile-
FROM node:8-slim
RUN apt-get update && apt-get install --no-install-recommends -y ca-certificates curl fontconfig fonts-liberation gconf-service git libappindicator1 libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 locales lsb-release unzip wget xdg-utils
RUN apt-get update && apt-get install -y wget --no-install-recommends && wget -q …Run Code Online (Sandbox Code Playgroud)