久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    • <bdo id='zRkrD'></bdo><ul id='zRkrD'></ul>

    <i id='zRkrD'><tr id='zRkrD'><dt id='zRkrD'><q id='zRkrD'><span id='zRkrD'><b id='zRkrD'><form id='zRkrD'><ins id='zRkrD'></ins><ul id='zRkrD'></ul><sub id='zRkrD'></sub></form><legend id='zRkrD'></legend><bdo id='zRkrD'><pre id='zRkrD'><center id='zRkrD'></center></pre></bdo></b><th id='zRkrD'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='zRkrD'><tfoot id='zRkrD'></tfoot><dl id='zRkrD'><fieldset id='zRkrD'></fieldset></dl></div>

      <legend id='zRkrD'><style id='zRkrD'><dir id='zRkrD'><q id='zRkrD'></q></dir></style></legend>

    1. <tfoot id='zRkrD'></tfoot>

      1. <small id='zRkrD'></small><noframes id='zRkrD'>

        Node.js - 開發(fā)中的自動刷新

        Node.js - Auto Refresh In Dev(Node.js - 開發(fā)中的自動刷新)

        <small id='80wNa'></small><noframes id='80wNa'>

          <tbody id='80wNa'></tbody>
      2. <tfoot id='80wNa'></tfoot>

          <i id='80wNa'><tr id='80wNa'><dt id='80wNa'><q id='80wNa'><span id='80wNa'><b id='80wNa'><form id='80wNa'><ins id='80wNa'></ins><ul id='80wNa'></ul><sub id='80wNa'></sub></form><legend id='80wNa'></legend><bdo id='80wNa'><pre id='80wNa'><center id='80wNa'></center></pre></bdo></b><th id='80wNa'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='80wNa'><tfoot id='80wNa'></tfoot><dl id='80wNa'><fieldset id='80wNa'></fieldset></dl></div>

          <legend id='80wNa'><style id='80wNa'><dir id='80wNa'><q id='80wNa'></q></dir></style></legend>

                • <bdo id='80wNa'></bdo><ul id='80wNa'></ul>
                  本文介紹了Node.js - 開發(fā)中的自動刷新的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我正在嘗試改善我的 Node.js 中的 DEV 體驗(yàn).為此,我想:

                  a) 更改服務(wù)器端代碼時重新啟動我的服務(wù)器
                  b) 當(dāng)客戶端代碼發(fā)生變化時刷新瀏覽器.

                  為了實(shí)現(xiàn)這一點(diǎn),我開始集成 nodemon 和browserSync 到我的 gulp 腳本中.

                  I am trying to improve the DEV experience in my Node. To do that, I want to:

                  a) restart my server when server-side code is changed
                  b) refresh the browser when client-side code is changes.

                  In an effort to accomplish this, I began integrating nodemon and browserSync into my gulp script.

                  在我的 gulp 腳本中,我有以下任務(wù):

                  In my gulp script, I have the following task:

                  gulp.task('startDevEnv', function(done) {
                      // Begin watching for server-side file changes
                      nodemon(
                          { script: input.server, ignore:[input.views] })
                          .on('start', function () {
                              browserSync.init({
                                  proxy: "http://localhost:3002"
                              });
                          })
                      ;    
                  
                      // Begin watching client-side file changes
                      gulp.watch([ input.css, input.js, input.html ], function() { browserSync.reload(); });
                      done();
                  });
                  

                  當(dāng)上述任務(wù)運(yùn)行時,我的瀏覽器會打開 http://localhost:3000/.我的應(yīng)用程序按預(yù)期可見.但是,在控制臺窗口中,我注意到:

                  When the above task runs, my browser opens to http://localhost:3000/. My app is visible as expected. However, in the console window, I notice:

                  Error: listen EADDRINUSE :::3002
                  

                  我在某種程度上理解.我的 server.js 文件中有 app.set('port', process.env.PORT || 3002); .然而,我認(rèn)為這是設(shè)置代理值的目的.盡管如此,每當(dāng)我更改代碼時,我都會在控制臺窗口中看到以下相關(guān)錯誤:

                  I understand to some extend. I have app.set('port', process.env.PORT || 3002); in my server.js file. Yet, I thought that was purpose of setting the proxy value. Still, whenever I make a code change, I see the following related error in my console window:

                  [07:08:19] [nodemon] restarting due to changes...
                  [07:08:19] [nodemon] starting `node ./dist/server.js`
                  events.js:142
                        throw er; // Unhandled 'error' event
                        ^
                  
                  TypeError: args.cb is not a function
                      at Object.init (/Users/me/Website/Develop/node_modules/browser-sync/lib/public/init.js:25:25)
                      at null.<anonymous> (/Users/me/Website/Develop/gulpfile.js:142:25)
                      at emitNone (events.js:73:20)
                      at emit (events.js:167:7)
                      at Object.run (/Users/me/Website/Develop/node_modules/nodemon/lib/monitor/run.js:97:7)
                      at Function.run.kill (/Users/me/Website/Develop/node_modules/nodemon/lib/monitor/run.js:221:7)
                      at null.<anonymous> (/Users/me/Website/Develop/node_modules/nodemon/lib/monitor/run.js:333:7)
                      at emitOne (events.js:83:20)
                      at emit (events.js:170:7)
                      at restartBus (/Users/me/Website/Develop/node_modules/nodemon/lib/monitor/watch.js:162:7)
                  Me-MBP:Develop me$ events.js:142
                        throw er; // Unhandled 'error' event
                        ^
                  
                  Error: listen EADDRINUSE :::3002
                      at Object.exports._errnoException (util.js:856:11)
                      at exports._exceptionWithHostPort (util.js:879:20)
                      at Server._listen2 (net.js:1238:14)
                      at listen (net.js:1274:10)
                      at Server.listen (net.js:1370:5)
                      at Object.<anonymous> (/Users/me/Website/Develop/dist/server.js:70:8)
                      at Module._compile (module.js:399:26)
                      at Object.Module._extensions..js (module.js:406:10)
                      at Module.load (module.js:345:32)
                      at Function.Module._load (module.js:302:12)
                  

                  此時,我的代碼更改不會出現(xiàn)在我的瀏覽器中.我不明白我做錯了什么.我懷疑我的端口配置錯誤.但是,我不確定它們應(yīng)該如何設(shè)置.

                  At this point, my code changes do not appear in my browser. I do not understand what I'm doing wrong. I suspect I have my ports misconfigured. But, I'm not really sure how they should be setup.

                  默認(rèn)情況下,BrowserSync 使用端口 3000.BrowserSync 還為 BrowserSync UI 使用端口 3001.由于這兩個原因,我想我應(yīng)該在 server.js 文件中將端口設(shè)置為 3002 并創(chuàng)建上面顯示的代理.我做錯了什么?

                  By default BrowserSync uses port 3000. BrowserSync also uses port 3001 for the BrowserSync UI. For these two reasons, I thought I would set the port to 3002 in my server.js file and create the proxy shown above. What am I doing wrong?

                  推薦答案

                  你實(shí)際上不需要使用 gulp 來工作.

                  You actually don't need to use gulp for this to work.

                  a) 更改服務(wù)器端代碼時重新啟動我的服務(wù)器

                  a) restart my server when server-side code is changed

                  使用 npm i -g nodemon 全局安裝 nodemon,然后在您的應(yīng)用文件夾中執(zhí)行 nodemonnodemon ${index-file-of-your-app}.

                  Install nodemon globally using npm i -g nodemon then on your app folder do nodemon or nodemon ${index-file-of-your-app}.

                  b) 當(dāng)客戶端代碼發(fā)生變化時刷新瀏覽器.

                  b) refresh the browser when client-side code is changes.

                  使用 browserify 或 webpack.我更喜歡使用 webpack;你可能需要稍微了解一下配置,但是 webpack 的好處是你不需要刷新它.一旦發(fā)現(xiàn)更改,更改將自動反映在瀏覽器上.https://github.com/webpack/docs/wiki/hot-module-replacement-與-webpack

                  Use browserify or webpack. I prefer using webpack; you may need to learn about the configuration a little bit but the good thing with webpack is that you don't need to refresh it. Once changes are found the changes will be reflected on the browser automatically. https://github.com/webpack/docs/wiki/hot-module-replacement-with-webpack

                  這篇關(guān)于Node.js - 開發(fā)中的自動刷新的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Browserify, Babel 6, Gulp - Unexpected token on spread operator(Browserify,Babel 6,Gulp - 傳播運(yùn)算符上的意外令牌)
                  Is it possible to pass a flag to Gulp to have it run tasks in different ways?(是否可以將標(biāo)志傳遞給 Gulp 以使其以不同的方式運(yùn)行任務(wù)?)
                  Why do we need to install gulp globally and locally?(為什么我們需要在全局和本地安裝 gulp?)
                  How to run Gulp tasks sequentially one after the other(如何一個接一個地依次運(yùn)行 Gulp 任務(wù))
                  Stylesheet not loaded because of MIME-type(由于 MIME 類型而未加載樣式表)
                  Visual Studio 2015 crashes when opening Javascript files(打開 Javascript 文件時 Visual Studio 2015 崩潰)

                    <i id='qiA03'><tr id='qiA03'><dt id='qiA03'><q id='qiA03'><span id='qiA03'><b id='qiA03'><form id='qiA03'><ins id='qiA03'></ins><ul id='qiA03'></ul><sub id='qiA03'></sub></form><legend id='qiA03'></legend><bdo id='qiA03'><pre id='qiA03'><center id='qiA03'></center></pre></bdo></b><th id='qiA03'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='qiA03'><tfoot id='qiA03'></tfoot><dl id='qiA03'><fieldset id='qiA03'></fieldset></dl></div>
                    • <tfoot id='qiA03'></tfoot>
                      <legend id='qiA03'><style id='qiA03'><dir id='qiA03'><q id='qiA03'></q></dir></style></legend>

                      <small id='qiA03'></small><noframes id='qiA03'>

                      • <bdo id='qiA03'></bdo><ul id='qiA03'></ul>
                            <tbody id='qiA03'></tbody>

                          • 主站蜘蛛池模板: 一区网站 | 亚洲视频中文字幕 | 欧美激情啪啪 | 一区二区三区免费观看 | 福利av在线| 久久久精品国产 | 成人在线电影在线观看 | 日韩毛片网 | 久久成人国产精品 | 久久青草av | 成人精品一区二区三区 | 亚洲成人av在线播放 | 午夜男人天堂 | a级毛片基地 | 久久久999精品 | 成人免费视频播放 | 一区视频在线免费观看 | 欧美精品影院 | 91久色 | 欧美精品欧美精品系列 | 亚洲精品电影在线观看 | www.久久99| 亚洲精品成人 | 免费视频成人国产精品网站 | 看a级黄色毛片 | 久草网免费 | 免费观看黄色一级片 | 久久国产成人午夜av影院武则天 | 99精品欧美一区二区三区综合在线 | 91在线一区 | 一区二区在线免费观看视频 | 欧美在线观看网站 | 中文字幕精品视频 | 国产片一区二区三区 | 日韩一区二区在线看 | 能免费看的av | 免费观看黄网站 | 欧美一区二区在线播放 | 日韩精品一区二区三区 | 久久久久久国产精品免费免费狐狸 | 毛片免费观看 |