Skip to content

cannot run yarn preview && problem with scripts/open-preview.js #2

@swartz-k

Description

@swartz-k

my system

OSX: 10.14.5 (18F132)
node: v11.7.0
npm: 6.5.0
yarn: 1.13.0

when act as README.md,yarn build and yarn preview,i got problem as below

yarn run v1.13.0
$ yarn build && node ./scripts/open-preview.js
$ webpack -p
Hash: 5897a1fa9153d9f5095a
Version: webpack 4.17.0
Time: 841ms
Built at: 2019/06/14 下午4:01:10
    Asset      Size  Chunks             Chunk Names
worker.js  30.6 KiB       0  [emitted]  main
[3] ./src/index.js 8.21 KiB {0} [built]
    + 5 hidden modules
(node:54375) UnhandledPromiseRejectionWarning: Error: Exited with code 1
    at ChildProcess.cp.once.code (workers-react-pwa-example/node_modules/opn/index.js:84:13)
    at Object.onceWrapper (events.js:276:13)
    at ChildProcess.emit (events.js:188:13)
    at maybeClose (internal/child_process.js:978:16)
    at Socket.stream.socket.on (internal/child_process.js:395:11)
    at Socket.emit (events.js:188:13)
    at Pipe._handle.close (net.js:609:12)
(node:54375) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

as it show,./scripts/open-preview.js has problem
so i change it to

newWorker(data).then(id =>
    opn(
      "https://cloudflareworkers.com/#" + id + ":https://reactjs.org",
      { app: "google chrome"}
    ).catch((e) => {
      console.log(e)
    })
);

lucky, it work for me,so i think if possible add a catch func and opn need different value of app,depented on OS

{ app: "chrome"}     # using Windows
{ app: "google chrome"}   # MAC 
{ app: "google-chrome"}   # Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions