我在 package.json
"scripts": {
"start": "node bin/www"
},
当我输入 npm start
时,它正在运行我的 express 应用程序。
但我希望浏览器同时打开 http://localhost:8081
。我怎么能对 start
说也打开我的本地 url?
like: "start": "node bin/www, http://localhost:8081"
所以当我输入 npm satrt
时,它会运行我的快速应用程序并同时打开网址。
最佳答案
据我所知,这就像写一个 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"
关于node.js - npm "scripts": "start" run express and open url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35261535/