Npm“脚本”:“开始”运行express和打开url [英] Npm "scripts": "start" run express and open url
本文介绍了Npm“脚本”:“开始”运行express和打开url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个开始的参数在 package.json
脚本:{
start:node bin / www
},
正在运行我的espress应用程序,我正在输入 npm start
。
但是我希望浏览器同时打开 http:// localhost:8081
我如何说开始
打开我的本地url呢?
喜欢:start:node bin / www,http:// localhost:8081
p>
所以当我输入 npm satrt
它运行我的快速应用程序并打开url在同一时间。 >
解决方案
据我所知,这就像写一个bash命令:
// Windows
start:start http:// localhost:8081& node bin / www
// Mac
start:open http:// localhost:8081&& Node bin / www
// Linux
start:xdg-open http:// localhost :8081& Node bin / www
I have this start params in package.json
"scripts": {
"start": "node bin/www"
},
It is running my espress app whan I am typing npm start
.
But I want browser opened http://localhost:8081
at the same time. How can I say to start
to open my local url as well?
like: "start": "node bin/www, http://localhost:8081"
So when I am typing npm satrt
it is runs my express app and opens url at the same time.
解决方案
As far as I know it's like writing a bash command:
// Windows
"start":"start http://localhost:8081 & node bin/www"
// Mac
"start":"open http://localhost:8081 && node bin/www"
// Linux
"start":"xdg-open http://localhost:8081 && node bin/www"
这篇关于Npm“脚本”:“开始”运行express和打开url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文