For example, there is a small script that works if you run directly from the project where it is developed.

It is assembled via NPM Run Build does not work by issuing an error.

Script code

const browserurl= ""
const url= "https://ya.ru"
Const Start= Async ()= >
    Const Browser= Await Puppeteer.Connect ({
        DefaultViewPort: {
            Width: 1920, Height: 1080
    Const page= await browser.newpage ();

Describing in php_storm . If in it, in the terminal, execute Node. \ src \ r.js That browser opens ya.ru .

if you perform NPM Run Build and try to execute the resulting script then gives an error

(Node: 3852) unhandledpromiserejectionwarning: typeerror: failed to fetch browser websocket url from Fetch Is Not a Function
    AT GetWsendPoint (D: \ JS \ R.js: 8494: 30)
    AT Async Object.ConnectTobrowser (D: \ JS \ R.js: 8481: 31)
    AT ASYNC START (D: \ JS \ R.JS: 33806: 21)
(USE `Node --Trace-Warnings ...` To show Where The Warning Was Created)
(Node: 3852) UnhandledpromiseRejectionWarning: Unhandled Promise Rejection. This error originated either by Throwing Inside An Async Function Without A Catch Block, Or by Rejecting A Catch Block, Or by Rejecting A Promise Which Was Not Handled with .catch (). To Terminate The Node Process On Unhandled Promise Rejection, Use The Cli Flag `--unhandled-Rejections= Strict` (See https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (Rejection ID: 1)
(Node: 3852) [DEP0018] Deprecationwarning: Unhandled Promise Rejections Are Deprecated. In The Future, Promise Rejections That Are Not Handled Will Terminate The Node.js Process with a non-Zero Exit Code.


Const RConfig= {
    Entry: './src/r.js',
    Target: "Node",
    Optimization: {
        Minimize: False.
    Output: {
        FileName: "R.JS",
        Path: 'D: \\ js'
module.exports= [rconfig]


  "scripts": {
    "BUILD": "WebPack"
  "Dependencies": {
    "Puppeteer": "^ 10.2.0"
  "DevDependenCies": {
    "WebPack": "^ 5.52.1",
    "WebPack-Cli": "^ 4.8.0"

What happens? Why does not it work.

1. I can not argue to answer why VEBPAC. Tell me something else?

Варфаламей Изольдин2021-09-17 06:24:12

2. First you need to run chrome here so chrome.exe --remote-debugging-port= 21223

Варфаламей Изольдин2021-09-17 06:24:12

1. Let me ask a question otherwise, why do you bought this project? 2. Could it be that chrome or not running, or is it already running and is engaged?

nörbörnën2021-09-17 06:24:12

Tell us why do you bought this project by the web site? By the way, your script for me when starting it gives the same error -maybe something bad should be launched? (You Need to Launch Chrome with the --remote-debugging-port= 21223 Argument)

nörbörnën2021-09-17 06:24:12