我在package.json
中有这个起始参数
"scripts": {
"start": "node bin/www"
},
当我输入npm start
时,它正在运行我的express应用程序。
但我希望浏览器同时打开http://localhost:8081
。我怎么才能让start
也打开我的本地url呢?
喜欢:"start": "node bin/www, http://localhost:8081"
因此,当我输入npm satrt
时,它会运行我的express应用程序,同时打开url。
发布于 2016-02-08 10:34:11
据我所知,这就像是编写一个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"
发布于 2017-03-15 22:10:08
要获得跨平台支持,请使用open-cli。
安装它:
npm install --save-dev open-cli
将其添加到脚本中:
"start": "open-cli http://localhost:8081 && node bin/www"
发布于 2017-07-26 10:44:51
您只需要以正确的顺序使用start
!
"start": "npm run dev & start http://localhost:8000",
坏的
"start": "start http://localhost:8000 & npm run dev",
好的
https://stackoverflow.com/questions/35261535
复制相似问题