简体   繁体   English

未找到 NPM 模块 - Puppeteer

[英]NPM Module Not Found - Puppeteer

I can't install Puppeteer.我无法安装 Puppeteer。 I get the same error if I do npm install .如果我执行npm install我会得到同样的错误。

在此处输入图片说明

This could be a few problems and would need to know more about your project setup to really help but here are my theories.这可能是一些问题,需要更多地了解您的项目设置才能真正提供帮助,但这是我的理论。

It would seem you do not have a package.json in that location, so npm is unable to download and build a node_modules with the puppeteer package.看起来您在该位置没有 package.json,因此 npm 无法使用 puppeteer 包下载和构建 node_modules。 Try running this first:尝试先运行这个:

npm init -y
npm install --save puppeteer

The -y just auto accepts a default npm setup. -y just auto 接受默认的 npm 设置。 Then you can run:然后你可以运行:

Or if you do already have a node_modules and npm initialized, I would try:或者,如果您已经有 node_modules 和 npm 初始化,我会尝试:

rm -rf node_modules
npm install

Lastly, if you are looking to run this globally you should be installing this with最后,如果你想在全球范围内运行它,你应该安装它

npm install -g puppeteer

If all of those don't work a good bet would be to reinstall Node and try again.如果所有这些都不起作用,最好的办法是重新安装 Node 并重试。

Also, check out the new version of puppeteer built by the same devs but at Microsoft!另外,请查看由相同开发人员但在 Microsoft 构建的新版本的 puppeteer! Playwright剧作家

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM