最简单的方法就是cd/node_moudle/puppeteer 然后npm run install即可.
千万不要设置环境变量
PUPPETEER_SKIP_DOWNLOAD=true npm install puppeteer
因为你设置了他会跳过,只需要进入puppeteer路径,进行安装就可以了.

再就是安装后可能会报错.需要安装几个包才可以使用.

/home/work/node_modules/puppeteer/.local-chromium/linux-856583/chrome-linux/chrome: error while loading shared libraries: libatk-1.0.so.0: cannot open shared object file: No such file or directory

解决:yum install atk
chrome: error while loading shared libraries: libatk-bridge-2.0.so.0: cannot open shared object file: No such file or directory
解决:yum install at-spi2-atk

chrome: error while loading shared libraries: libxkbcommon.so.0: cannot open shared object file: No such file or directory

解决:yum install libxkbcommon-x11-devel
chrome: error while loading shared libraries: libXcomposite.so.1: cannot open shared object file: No such file or directory

解决:yum install libXcomposite
chrome: error while loading shared libraries: libgtk-3.so.0: cannot open shared object file: No such file or directory
解决:yum install gtk3

根据报错安装对应的包即可.

最后修改:2022 年 04 月 19 日 06 : 00 PM
如果觉得我的文章对你有用,请随意赞赏