cloudflare / cloudflare/workers-react-pwa-example
cannot run yarn preview && problem with scripts/open-preview.js
- Lingua principale
- JavaScript
- Stelle
- 86
- Fork
- 12
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
### 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
```
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Esamina scripts/open-preview.js e il flusso del README per yarn build seguito da yarn preview. Riproduci il fallimento di opn nella configurazione segnalata, quindi verifica che il comando di preview gestisca gli errori di avvio del browser e utilizzi il valore app appropriato sui diversi sistemi operativi. Il lavoro è completato quando il comando non produce più un rifiuto di promise non gestito durante l'apertura della preview.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, node.js, webpack
- Ambito
- build-system, tooling
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100