否则,当我尝试使用 Puppeteer 运行测试时,我得到Error: Chromium revision is not downloaded. Run "npm install" or "yarn install"
似乎npm i
在我的部门中使用 Puppeteer 就足够了,但是安装完成后,我需要cd
进入/node_modules/puppeteer
然后运行node install.js
以下载正确的修订版。
当我做初始npm i
我看到
> puppeteer@1.13.0 install /Users/.../node_modules/puppeteer
> node install.js
Downloading Chromium r549031 - 76 Mb [====================] 100% 0.0s
Chromium downloaded to /Users/.../node_modules/puppeteer/.local-chromium/mac-549031
但这不起作用,我收到修订错误。
在我node install.js
进入 Puppeteer 的目录之后,我看到了
Downloading Chromium r637110 - 85.9 Mb [====================] 100% 0.0s
Chromium downloaded to /Users/.../node_modules/puppeteer/.local-chromium/mac-637110
那我可以走了。
任何想法为什么?这是在 macOS 和 Node 10.15 上,我认为在 CI 中执行此操作会更加困难。
我四处搜索,发现其他人有这个问题,但没有解决这个问题的可靠方法。
包.json
"devDependencies": {
"@babel/core": "^7.3.3",
"@babel/preset-env": "^7.3.1",
"babel-jest": "^24.1.0",
"babel-loader": "^8.0.5",
"eslint": "^5.14.1",
"html-webpack-plugin": "^3.2.0",
"husky": "1.1.2",
"jest": "^24.1.0",
"jest-puppeteer": "^4.1.0",
"lint-staged": "7.3.0",
"prettier-eslint-cli": "4.7.1",
"puppeteer": "^1.13.0",
"webpack": "^4.29.5",
"webpack-bundle-analyzer": "^3.1.0",
"webpack-cli": "^3.2.3",
"webpack-dev-server": "^3.2.1",
"webpack-shell-plugin": "^0.5.0"
},