[英]Installing puppeteer results in “file already exists” error
When I first tried to install puppeteer through npm, I got errors saying permission is denied for the .local-chromium
folder.当我第一次尝试通过 npm 安装 puppeteer 时,我收到错误消息说.local-chromium
文件夹的权限被拒绝。 So I followed this SO post and that error went away, but now there is another (base path is omitted):所以我跟着这个 SO 帖子,那个错误消失了,但现在有另一个(基本路径被省略):
$ sudo npm install puppeteer --unsafe-perm=true
> puppeteer@5.2.1 install ##########/node_modules/puppeteer
> node install.js
(node:25349) ExperimentalWarning: The fs.promises API is experimental
Downloading Chromium r782078 - 126.4 Mb [====================] 100% 0.0s
ERROR: Failed to set up Chromium r782078! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
{ [Error: EEXIST: file already exists, mkdir '##########/node_modules/puppeteer/.local-chromium/linux-782078']
errno: -17,
code: 'EEXIST',
syscall: 'mkdir',
path:
'##########/node_modules/puppeteer/.local-chromium/linux-782078' }
npm WARN notsup Unsupported engine for puppeteer@5.2.1: wanted: {"node":">=10.18.1"} (current: {"node":"10.4.0","npm":"6.14.7"})
npm WARN notsup Not compatible with your version of node/npm: puppeteer@5.2.1
npm WARN notsup Unsupported engine for extract-zip@2.0.1: wanted: {"node":">= 10.17.0"} (current: {"node":"10.4.0","npm":"6.14.7"})
npm WARN notsup Not compatible with your version of node/npm: extract-zip@2.0.1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppeteer@5.2.1 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the puppeteer@5.2.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! ######/.npm/_logs/2020-07-30T16_32_37_096Z-debug.log
But that directory doesn't exist, nor does puppeteer
at all within node_modules
so I can't delete it and retry.但是该目录不存在, puppeteer
中的node_modules
也不存在,所以我无法删除它并重试。 I'm not sure what the installation is reffering to.我不确定安装指的是什么。 Does anybody have any idea what it could mean?有人知道这意味着什么吗?
Also, this is irrelevant but another concern is with the warnings saying that a node version >=10.18.1
is wanted and so 10.4.0
is unsupported, any ideas what's up with that as well?另外,这无关紧要,但另一个问题是警告说需要节点版本>=10.18.1
,因此不支持10.4.0
,还有什么想法吗?
I ended up using nvm
to switch to the stable Node release (10.18.1) which resolved both the errors and the warnings.我最终使用nvm
切换到稳定的 Node 版本(10.18.1),它解决了错误和警告。 I guess there was some incompatibility with newer Node versions.我猜想与较新的 Node 版本有些不兼容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.