node.js - Docker - Puppeteer 需要一些东西并且不会运行
问题描述
我已经从 NodeJS 应用程序创建了一个带有 Docker 的容器,
但是当我尝试运行它时,应用程序将启动但进入错误循环。
我的 Dockerfile 包含
RUN npm install
但它不断突破:
ERROR PuppeteerCrawler:PuppeteerPool: Browser launch failed {"id":12}
Error: Could not find browser revision 756035. Run "npm install" or "yarn install" to download a browser binary
如果我运行 Node main.js 没有问题。
//Dockerfile
FROM apify/actor-node-basic
COPY package*.json ./
RUN npm --quiet set progress=false \ && npm install --only=prod
--no-optional \ && echo "Installed NPM packages:" \ && npm list \ && echo "Node.js version:" \ && node --version \ && echo "NPM version:" \ && npm --version
COPY . ./
WORKDIR .
USER node
RUN npm install
COPY --chown=node:node . .
EXPOSE 8080
CMD [ "node", "Worker.js" ]
// package.json
{
"name": "SoccerBrain",
"version": "0.0.1",
"description": "This is an example of an Apify actor.",
"dependencies": {
"apify": "^0.21.0",
"puppeteer": "^5.0.0",
"rimraf": "^3.0.2"
},
"devDependencies": {},
"scripts": {
"start": "node Worker.js",
"test": "echo \"Error: oops, the actor has no tests yet, sad!\" && exit 1"
},
"author": "It's not you it's me",
"license": "ISC"
}
什么是附加?
解决方案
推荐阅读
- javascript - 循环遍历数组以呈现多个图表
- java - IFile.getFile 区分大小写
- android - 在 Android 游戏中控制精灵动画速度的标准方法
- c++ - 编译简单 boot_mpi 分散程序时出错:没有序列化元素
- python - VS 代码未加载 Python 解释器
- c# - WPF MVVM - 组合框绑定选定值
- android-security - 与 PayPal android 相关的 HostnameVerifier 接口的不安全实现
- c# - ' SqliteConnection '对象引用未设置为对象的实例。对于内存数据库
- python - 如何从复杂的字典中选择某个值
- c++ - (C++)负双精度与正整数的除法给了我正的结果