簡體   English   中英

npm start無法打開瀏覽器選項卡

[英]npm start does not open browser tab

我正在學習angularjs 2.我想從他們的官方網站在angularjs 2中首次申請。所以我從這里跟隨所有人https://angular.io/guide/quickstart 現在在步驟6中我必須在終端中運行命令'npm start'。它給我的結果像終端一樣 -

$ npm start

> angular-quickstart@1.0.0 start D:\Sadiq\Res\Angularjs__2\angularQ
> tsc && concurrently "tsc -w" "lite-server"

[1] Did not detect a `bs-config.json` or `bs-config.js` override file. Using lite-server defaults...
[1] ** browser-sync config **
[1] { injectChanges: false,
[1]   files: [ './**/*.{html,htm,css,js}' ],
[1]   watchOptions: { ignored: 'node_modules' },
[1]   server: { baseDir: './', middleware: [ [Function], [Function] ] } }
[1] [BS] Access URLs:
[1]  -------------------------------------
[1]        Local: http://localhost:3002
[1]     External: http://192.168.2.93:3002
[1]  -------------------------------------
[1]           UI: http://localhost:3003
[1]  UI External: http://192.168.2.93:3003
[1]  -------------------------------------
[1] [BS] Serving files from: ./
[1] [BS] Watching files...
[1] [BS] File changed: app\app.component.js
[1] [BS] File changed: app\app.module.js
[1] [BS] File changed: app\main.js
[0] 12:01:51 PM - Compilation complete. Watching for file changes.

但它沒有在我的crome中打開任何標簽。如果我輸入它提供的網址

' http:// localhost:3002 '

在地址欄中手動提供預期的結果,工作正常,源文件中的任何更改都會立即導致瀏覽器發生更改。 問題是:我無法弄清楚為什么它不能自動打開瀏覽器中的標簽。 誰能幫我?

更新2016年11月7日

重要的觀察是我將我的項目復制到另外兩台電腦中。 在那里它按預期工作。當我運行'npm start'時,它在瀏覽器中打開選項卡並運行應用程序。所以它創建沒有問題,並根據官方angular2教程site.can任何人都知道為什么這發生在我的電腦還是我的瀏覽器?

一切看起來都很好,唯一的原因可能是你的配置中有open:false。 你能試試嗎

在root上創建一個文件bs-config.js並添加此代碼,

module.exports = {
  port: 5000,//custom port
  files: ['./**/*.{html,htm,css,js}'],
  open: true
};

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM