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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34831781/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 03:13:09  来源:igfitidea点击:

Angular2 : concurrent is not recognized as internal or external command

node.jstypescriptwebserverdevelopment-environmentangular

提问by blackHawk

While running server for angular2 using npm start is giving error that concurrent is not recognized as internal or external command, why is it happens these kind of error

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

here is package.json:

这是 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"
  }
}

structure of the project is there is node_module and typings folder there is app.ts file for server(empty only express is imported), and component.ts(and their .js), tsconfig.json

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

回答by Langley

concurrent is not recognized as internal or external command

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

Must likely you haven't ran npm installsince you added the "concurrently": "^1.0.0"dependency.

npm install自从添加"concurrently": "^1.0.0"依赖项以来,您很可能还没有运行过。

live-server is not recognized as external or internal command

live-server 不被识别为外部或内部命令

You are installing the lite-server:

您正在安装lite-server

"lite-server": "^1.3.1"

"lite-server": "^1.3.1"

yet you are calling the live-server:

但您正在调用live-server

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

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

call lite-serverinstead.

lite-server改为调用。