Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/436.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 未找到Puppeter相对模块和依赖项_Javascript_Npm_Webpack_Websocket_Puppeteer - Fatal编程技术网

Javascript 未找到Puppeter相对模块和依赖项

Javascript 未找到Puppeter相对模块和依赖项,javascript,npm,webpack,websocket,puppeteer,Javascript,Npm,Webpack,Websocket,Puppeteer,我使用npm安装了Puppeter,然后在尝试编译它时,出现了错误: This dependency was not found: * ws in ./node_modules/puppeteer/lib/WebSocketTransport.js To install it, you can run: npm install --save ws These relative modules were not found: * ./types/other in ./node_modul

我使用npm安装了Puppeter,然后在尝试编译它时,出现了错误:

This dependency was not found:

* ws in ./node_modules/puppeteer/lib/WebSocketTransport.js

To install it, you can run: npm install --save ws


These relative modules were not found:

* ./types/other in ./node_modules/puppeteer/node_modules/mime/index.js
* ./types/standard in ./node_modules/puppeteer/node_modules/mime/index.js 
关于
ws
:我尝试使用
npm install--save ws
再次安装ws,但仍然相同

关于
/types/other
.types/standard
,我试图编辑文件
node\u modules/puppeter/node\u modules/mime/index.js
,并在require中的文件名末尾添加了
.json
。我知道从供应商文件夹编辑文件是不正确的,但我不知道如何以正确的方式修复它

我尝试了以下解决方案:

但仍然没有运气,或者我不知道我是否理解正确

这是我的package.json:

{
  "jest": {
    "moduleFileExtensions": [
      "json",
      "vue",
      "js"
    ]
  },
  "private": true,
  "scripts": {
     ...
  },
  "devDependencies": {
    "axios": "^0.17",
    "bootstrap": "^4.1.3",
    "cross-env": "^5.2.0",
    "jquery": "^3.2",
    "laravel-mix": "^2.1.14",
    "lodash": "^4.17.11",
    "popper.js": "^1.14.4",
    "postcss-css-variables": "^0.9.0",
    "vue": "^2.5.17"
  },
  "dependencies": {
    "ajv": "^6.0.0",
    "imagemin": "^5.0.0",
    "npm": "^5.10.0",
    "puppeteer": "^1.14.0",
    "ws": "^6.2.1"
  }
}

我认为添加
jest
没有意义,因为我没有安装jest,但我现在不知道如何修复它。

因此,我在尝试使用Puppeter时遇到了相同的问题,但Puppeter本身的依赖性存在问题。我找不到解决方案,但我找到了另一种方法,仍然使用Pupeter抛出的另一个模块。首先在命令行中运行这些

npm install --save apify
然后再获取它的cli

npm install -g apify-cli
然后跑

apify create my-hello-world
选择了使用Puppeter的选项,它将提供一个现成的示例,您可以从那里开始,像往常一样使用Puppeter,它还提供了更多选项,如本地存储和在云中运行代码,但这些不是必须的,您可以用它来替代Puppeter

有关更多信息,请访问这是一个指向基本apify模块的链接,其中包含示例和命令

还有一个官方网站,以防你想在更高级的网页抓取中使用它
所以我在尝试使用木偶演员时遇到了同样的问题,但木偶演员本身的依赖性存在问题。我找不到解决方案,但我找到了另一种方法,仍然使用Pupeter抛出的另一个模块。首先在命令行中运行这些

npm install --save apify
然后再获取它的cli

npm install -g apify-cli
然后跑

apify create my-hello-world
选择了使用Puppeter的选项,它将提供一个现成的示例,您可以从那里开始,像往常一样使用Puppeter,它还提供了更多选项,如本地存储和在云中运行代码,但这些不是必须的,您可以用它来替代Puppeter

有关更多信息,请访问这是一个指向基本apify模块的链接,其中包含示例和命令

还有一个官方网站,以防你想在更高级的网页抓取中使用它

它可能重复的地方并不完全相同,但这是一个高度相关的问题。Webpack还不能捆绑Puppeter,但您可以使用提供的其他解决方案。检查链接的答案。可能重复的答案不完全相同,但这是高度相关的问题。Webpack还不能捆绑Puppeter,但您可以使用提供的其他解决方案。检查链接的答案。