npm start 不打开浏览器选项卡 [英] npm start does not open browser tab

查看:42
本文介绍了npm start 不打开浏览器选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习 angularjs 2.我想从他们的官方网站上在 angularjs 2 中制作我的第一个应用程序.所以我从这里关注了所有内容 https://angular.io/guide/quickstart.现在在第 6 步中,我必须在终端中运行命令npm start".它给了我类似终端的结果--

I am learning angularjs 2.I want to make my first application in angularjs 2 from their official website.So i followed all from here https://angular.io/guide/quickstart. Now in step 6 I have to run a command 'npm start' in terminal.It gives me result in terminal like--

$ 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中打开任何标签.如果我输入它提供的网址

But it does not open any tab in my crome.If i enter the url it provided

'http://localhost:3002'

在地址栏中手动提供预期结果,工作正常,源文件中的任何更改都会立即导致浏览器发生更改.问题是:我不明白为什么它没有在浏览器中自动打开标签.谁能帮我?

manually in the address bar it gives the result as expected,works fine and any changes in source file immediately cause change in the browser. problem is: I can not figure out why it is not open tab in browser automatically. Can anyone help me?

2016 年 11 月 7 日更新

重要的观察是我在另外两台电脑上复制了我的项目.在那里它按预期工作.当我运行npm start"时,它会在浏览器中打开选项卡并运行应用程序.因此它不会产生任何问题,并且可以根据官方 angular2 教程站点工作.任何人都知道为什么我的电脑会发生这种情况还是我的浏览器?

Important observation is that I copied my project in another two pc. There it works as expected.when i run 'npm start' it opens tab in browser and runs the application.So there it creates no problem and works according to official angular2 tutorial site.can anyone have any idea why this is happening in my pc or my browser?

推荐答案

一切看起来都很好,唯一的原因可能是你的配置中有 open:false.你可以试试这个吗,

Everything looks fine, only reason might be if you there is open:false in your config. Can you try this,

在根目录创建一个文件 bs-config.js &添加此代码,

create a file bs-config.js at root & add this code,

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

这篇关于npm start 不打开浏览器选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆