[英]Stop VS Code from opening a web browser window when I build my project in the console
I created a Hello World application using this tutorial. 我使用本教程创建了一个Hello World应用程序。
When I build the application from the terminal in VS Code typing npm start
VS Code or npm, no clue who, will open a new browser window... without even an url or anything in it. 当我从终端在VS Code中通过键入
npm start
VS Code或npm来构建应用程序时,不知道谁会打开一个新的浏览器窗口,甚至没有URL或任何内容。
Is there anyway to prevent this from happening? 是否有防止这种情况发生的方法? ie if I type in the console
npm start
I do not mind what happens but I want to avoid to open automatically a window of my browser. 即,如果我在控制台中键入
npm start
我不介意会发生什么,但是我想避免自动打开浏览器窗口。
Try to run BROWSER=none npm start
or create an .env
file with BROWSER=none
. 尝试运行
BROWSER=none npm start
或使用BROWSER=none
创建一个.env
文件。 Refer to Advanced Configuration of create-react-app official docs 请参阅create-react-app官方文档的高级配置
You can create a .env
file at the root of your project and insert the BROWSER=none npm start
property. 您可以在项目的根目录下创建一个
.env
文件,并插入BROWSER=none npm start
属性。
An alternative would be direct throught terminal, like this: set BROWSER=NONE && npm start
另一种选择是直接通过终端,例如:
set BROWSER=NONE && npm start
Here you can see the discussing about that. 在这里,您可以看到有关此问题的讨论。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.