首页 > 解决方案 > 如何使用 npm start 加载特定页面

问题描述

当我运行npm-start它时,它会加载,但是它只是加载http://127.0.0.1:8000.

我想http://127.0.0.1:8000/launch在运行时加载类似的东西npm start

下面是我的package.json

{
  "name": "myapp",
  "version": "0.1.3",
  "scripts": {
    "serve": "http-server -p 8000 -c-1 .",
    "start": "npm run serve",
  }
  ...
}

目前正在加载http://127.0.0.1:8000

这是我想看到的;http://127.0.0.1:8000/launch

标签: npmnode-modulesnpm-installpackage.jsonnpm-start

解决方案


Solution: npm install concurrently -g
然后在 package.jason 文件中更新服务

"serve": "concurrently \"http-server -p 8000 -c-1.\" \"start http://127.0.0.1:8000/launch\""

推荐阅读