Installation Chrome扩展的绑定傀儡程序引发错误
我目前正在尝试将Puppeter捆绑到我的Chrome扩展项目中,我将在网页上抓取一个位置页面,并使用传单将其显示在地图上。但是,我在设置过程中不断遇到问题。目前,我仍停留在流程的第2步和第3步。运行Installation Chrome扩展的绑定傀儡程序引发错误,installation,google-chrome-extension,puppeteer,Installation,Google Chrome Extension,Puppeteer,我目前正在尝试将Puppeter捆绑到我的Chrome扩展项目中,我将在网页上抓取一个位置页面,并使用传单将其显示在地图上。但是,我在设置过程中不断遇到问题。目前,我仍停留在流程的第2步和第3步。运行npm时,在由git克隆创建的\puppeter文件夹中安装https://github.com/puppeteer/puppeteer &&cd木偶演员返回的命令 Puppeteer: Compiling TypeScript... Error running TypeScript Error:
npm时,在由git克隆创建的\puppeter
文件夹中安装https://github.com/puppeteer/puppeteer &&cd木偶演员
返回的命令
Puppeteer: Compiling TypeScript...
Error running TypeScript Error: Command failed: npm run tsc
'rm' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppeteer@5.2.1-post clean-lib: `rm -rf lib`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the puppeteer@5.2.1-post clean-lib 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! C:\Users\username\AppData\Roaming\npm-cache\_logs\2020-08-31T21_57_06_630Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppeteer@5.2.1-post tsc: `npm run clean-lib && tsc --version && npm run tsc-cjs && npm run tsc-esm`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the puppeteer@5.2.1-post tsc 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! C:\Users\username\AppData\Roaming\npm-cache\_logs\2020-08-31T21_57_06_646Z-debug.log
at ChildProcess.exithandler (child_process.js:303:12)
at ChildProcess.emit (events.js:315:20)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) {
killed: false,
code: 1,
signal: null,
cmd: 'npm run tsc',
stdout: '\n' +
'> puppeteer@5.2.1-post tsc C:\\Users\\username\\node_modules\\puppeteer\n' +
'> npm run clean-lib && tsc --version && npm run tsc-cjs && npm run tsc-esm\n' +
'\n' +
'\n' +
'> puppeteer@5.2.1-post clean-lib C:\\Users\\username\\node_modules\\puppeteer\n' +
'> rm -rf lib\n' +
'\n',
stderr: "'rm' is not recognized as an internal or external command,\r\n" +
'operable program or batch file.\r\n' +
'npm ERR! code ELIFECYCLE\n' +
'npm ERR! errno 1\n' +
'npm ERR! puppeteer@5.2.1-post clean-lib: `rm -rf lib`\n' +
'npm ERR! Exit status 1\n' +
'npm ERR! \n' +
'npm ERR! Failed at the puppeteer@5.2.1-post clean-lib script.\n' +
'npm ERR! This is probably not a problem with npm. There is likely additional logging output above.\n' +
'\n' +
'npm ERR! A complete log of this run can be found in:\n' +
'npm ERR! C:\\Users\\username\\AppData\\Roaming\\npm-cache\\_logs\\2020-08-31T21_57_06_630debug.log\n' +
'npm ERR! code ELIFECYCLE\n' +
'npm ERR! errno 1\n' +
'npm ERR! puppeteer@5.2.1-post tsc: `npm run clean-lib && tsc --version && npm run tsc-cjs && npm run tsc-esm`\n' +
'npm ERR! Exit status 1\n' +
'npm ERR! \n' +
'npm ERR! Failed at the puppeteer@5.2.1-post tsc script.\n' +
'npm ERR! This is probably not a problem with npm. There is likely additional logging output above.\n' +
'\n' +
'npm ERR! A complete log of this run can be found in:\n' +
'npm ERR! C:\\Users\\username\\AppData\\Roaming\\npm-cache\\_logs\\2020-08-31T21_57_06_646Z-debug.log\n'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppeteer@5.2.1-post install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the puppeteer@5.2.1-post install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
而且当运行npm run bundle
时,它会显示缺少脚本:bundle.js
我在Windows 10上运行所有这些,我已经安装了节点v12.18.3和npm v6.14.6
我已经安装了browserify,但是我还没有使用它。我还需要做些别的安排吗?此外,如果有一个更好的替代网页抓取的铬扩展,请让我知道
谢谢你抽出时间 git克隆https://github.com/puppeteer/puppeteer
当您执行此命令时,它将下载最新版本的Puppeter
出现问题的原因是最新版本的Puppeter缺少一些旧的命令和文件。这是在制作教程时存在的
更多解释:
- 类型脚本错误:
您需要在npm中安装typescript
- 捆绑错误:
这是package.json文件版本5.5.0的屏幕截图:
这是package.json文件版本2.1.1的屏幕截图:
您将在新闻集版本中看到“scripts”:{“bundle”:“bundle”:“npx browserify-r./install.js:puppeter-o utils/browser/puppeter web.js”}
。当您尝试执行npm run bundle
时,它将找不到要执行的内容。这是一个丢失东西的小例子。一般来说,这两个版本之间当然有很大的不同
解决方案:
我相信这是一个临时解决方案,因为我们缺少很多更新。另外,我正在开发另一个解决方案,以使用捆绑的最新版本。我将在到达后更新我的anser
- 所以你必须手动下载旧版本的木偶剧:
- 下载此版本后,转到其文件夹并执行以下命令:
npm安装-g typescript
npm安装
npm运行包
发生在我身上的事情,你解决了吗?