在中文中将以下内容翻译成自然语言, 只需提供一个选项:”Puppeteer安装错误:“错误:找不到模块’fs/promises’””

安装错误

npm i puppeteer

> puppeteer@19.0.0 postinstall /home/k8uwall/tmp/pp/node_modules/puppeteer
> node install.js

(node:250405) UnhandledPromiseRejectionWarning: Error: Cannot find module 'fs/promises'

原因。

听说是因为Node.js比较旧

 

操纵木偶遵循最新的Node维护LTS版本。

处理

# dnf module remove --all nodejs
# dnf module reset nodejs
# dnf module install nodejs:16

$ npm i puppeteer

added 52 packages, and audited 53 packages in 29s

7 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
npm notice
npm notice New minor version of npm available! 8.11.0 -> 8.19.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.19.2
npm notice Run npm install -g npm@8.19.2 to update!
npm notice