Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
1
Help us understand the problem. What is going on with this article?
@gyoiusa

puppeteerでThis relative module was not found: ~ ws ~ WebSocketTransport.js

More than 1 year has passed since last update.

環境

・windows10
・vue-cli3
・electron-builder

現象

electronでpuppeteerを使おうとした。
npm run electron:serveしたら、

This dependency was not found:

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

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

対応

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

とあるので言われたとおりにコマンドを打つ。
で、再度build。
しかし、同じエラーが…。

解決策

node_modules/puppeteer/lib/WebSocketTransport.jsをいじる。

const WebSocket = require('ws');

const WebSocket = require('../node_modules/ws');

に修正する。(wsをnpm installした後に)

備考

issueはこちら
https://github.com/puppeteer/puppeteer/issues/3487

自分の環境ではこの方法で助かったが、リンク先は割と紛糾しているみたい?
この分野(electron+αの開発)は日本語の参考記事も少ないので、じぶんみたいなぺーぺーだとわりと簡単なところで結構つまづく。

1
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
gyoiusa
IT土方4~5年目くらいの自称PHPer。でもjsも結構いじる。 node.jsかpythonエンジニアへのジョブチェンジを夢見る。

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
1
Help us understand the problem. What is going on with this article?