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

时间:2016-01-16 20:27:22

标签: node.js typescript webserver development-environment angular

使用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文件用于服务器(空只表示已导入)和component.ts(及其.js),tsconfig.json

1 个答案:

答案 0 :(得分:13)

  

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

由于您添加了"concurrently": "^1.0.0"依赖项,因此您可能无法运行lite-server

  

实时服务器不被识别为外部或内部命令

您正在安装"lite-server": "^1.3.1"

live-server

然而你正在呼叫"serve": "./node_modules/.bin/live-server --host=localhost --port=3000 ."

lite-server

改为呼叫{{1}}。