简体   繁体   English

当我在控制台中构建项目时,阻止VS Code打开Web浏览器窗口

[英]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.

相关问题 停止节点调试以打开新的浏览器窗口 - Stop node-debug from opening a new browser window 从浏览器打开我的电子应用程序时如何获取输入 - How do i get inputs when opening my electron app from the browser 在投影仪上打开浏览器窗口 - Opening a browser window on a projector 为什么来自 POST 请求的控制台日志响应与我在浏览器控制台中看到的不同? - Why is my console log response from a POST request different to the one I see in my browser console? 在博览会的 Web 浏览器中打开项目,节点获取错误 - opening project in web browser in expo, error in node-fetch 当我从github repo克隆时,为什么我的webpack项目无法构建? - Why does my webpack project fail to build when i clone from github repo? 使用 Node.js 访问特定网页时的 400 状态代码。 从我的浏览器点击同一个网页时出现 200 状态代码。 是什么赋予了? - 400 status code when using Node.js to hit a specific web page. And a 200 status code when hitting same web page from my browser. What gives? 相同的代码,但 VS Code 和浏览器控制台的“this”的 output 不同 - Same code but different output of 'this' for VS Code and browser console 如何防止lite-server在启动时打开浏览器窗口? - how to prevent lite-server from opening browser window on startup? 如何停止我的代码异步运行? - How can i stop my code from running asynchronously?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM