Angular2:并发不被识别为内部或外部命令

Angular2 : concurrent is not recognized as internal or external command

虽然使用 npm start 的 angular2 的 运行 服务器给出了并发不被识别为内部或外部命令的错误,但为什么会发生这种错误

这里是 package.json:

{
  "name": "contactlistapp",
  "version": "1.0.0",
  "description": "The app",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "tsc": "./node_modules/.bin/tsc",
    "tsc:w": "./node_modules/.bin/tsc -w",
    "serve": "./node_modules/.bin/live-server --host=localhost --port=3000 .",
    "start": "concurrent \"npm run tsc:w\" \"npm run serve\" "
  },
  "author": "Sarah",
  "license": "ISC",
  "dependencies": {
    "express": "^4.13.3",
    "angular2": "2.0.0-beta.0",
    "systemjs": "0.19.6",
    "es6-promise": "^3.0.2",
    "es6-shim": "^0.33.3",
    "reflect-metadata": "0.1.2",
    "rxjs": "5.0.0-beta.0",
    "zone.js": "0.5.10"
  },
  "devDependencies": {
    "concurrently": "^1.0.0",
    "lite-server": "^1.3.1",
    "typescript": "^1.7.3"
  }
}

项目结构有 node_module 和 typings 文件夹有 app.ts 服务器文件(只导入空的 express)和 component.ts(及其 .js) , tsconfig.json

concurrent is not recognized as internal or external command

很可能你没有 运行 npm install 因为你添加了 "concurrently": "^1.0.0" 依赖。

live-server is not recognized as external or internal command

您正在安装 lite-server :

"lite-server": "^1.3.1"

然而你正在调用 live-server:

"serve": "./node_modules/.bin/live-server --host=localhost --port=3000 ."

改为调用 lite-server