操纵up的人与离子的角度失败无法解析'./types/other'

时间:2019-03-08 04:05:52

标签: angular typescript ionic-framework puppeteer

在角度7和离子4上出现以下错误

./node_modules/puppeteer/node_modules/mime/index.js
Module not found: Error: Can't resolve './types/other' in 'myapp\node_modules\puppeteer\node_modules\mime'

已经安装

“ @ types / puppeteer”:“ ^ 1.12.2”,

这是我的文件home.page.ts 我已经尝试过了,但是https://www.lewuathe.com/using-puppeteer-in-typescript.html

无效
import { Component } from '@angular/core';
import * as puppeteer from 'puppeteer';


@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
})
export class HomePage {

    onSubmitBuscar(){

        try {
        (async () => {
          const browser = await puppeteer.launch();
          const page = await browser.newPage();
          await page.goto('https://example.com');
          await page.screenshot({path: 'example.png'});

          await browser.close();
        })();
        } catch (err) {
            console.error(err)
        }

    }


}

1 个答案:

答案 0 :(得分:1)

您不能从角度启动人偶! 由于在chrome上有角度运行,因此您无法从chrome到os进行开放的新chrome扩展,因此您必须从nodejs运行puppeteer