Linux上的Angular 2 QuickStart无法正常工作

时间:2016-10-13 19:29:33

标签: node.js linux angular npm

我在虚拟机Linux机器版本上从头开始设置Angular 2快速入门教程。作为快速启动5分钟的一部分,我已按照所有说明操作,但是当我到达" npm start"我收到这个错误:

/ media / sf_testdev / angular-quickstart $ npm start

> angular-quickstart@1.0.0 start /media/sf_testdev/angular-quickstart
> tsc && concurrently "npm run tsc:w" "npm run lite" 

sh: 1: concurrently: not found

npm ERR! Linux 4.4.0-42-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v6.7.0
npm ERR! npm  v3.10.3
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! angular-quickstart@1.0.0 start: `tsc && concurrently "npm run tsc:w" "npm run lite" `
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the angular-quickstart@1.0.0 start script 'tsc && concurrently "npm run tsc:w" "npm run lite" '.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular-quickstart package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     tsc && concurrently "npm run tsc:w" "npm run lite" 
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular-quickstart
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /media/sf_testdev/angular-quickstart/npm-debug.log

这是我当前的package.json文件

{
  "name": "angular-quickstart",
  "version": "1.0.0",
  "scripts": {
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
    "lite": "lite-server",
    "postinstall": "typings install",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "typings": "typings"
  },
  "license": "ISC",
  "dependencies": {
    "@angular/common": "2.0.0-rc.6",
    "@angular/compiler": "2.0.0-rc.6",
    "@angular/compiler-cli": "0.6.0",
    "@angular/core": "2.0.0-rc.6",
    "@angular/forms": "2.0.0-rc.6",
    "@angular/http": "2.0.0-rc.6",
    "@angular/platform-browser": "2.0.0-rc.6",
    "@angular/platform-browser-dynamic": "2.0.0-rc.6",
    "@angular/router": "3.0.0-rc.2",
    "@angular/upgrade": "2.0.0-rc.6",
    "core-js": "^2.4.1",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.11",
    "systemjs": "0.19.27",
    "zone.js": "^0.6.17",
    "angular2-in-memory-web-api": "0.0.18",
    "bootstrap": "^3.3.6"
  },
  "devDependencies": {
    "concurrently": "^2.2.0",
    "lite-server": "^2.2.2",
    "typescript": "^1.8.10",
    "typings":"^1.3.2"
  }
}

我在网上尝试的任何内容似乎都无法修复。我在这里先向您的帮助表示感谢!

3 个答案:

答案 0 :(得分:1)

似乎错误是它试图同时运行命令

  

sh:1:同时:未找到

你必须首先运行npm install来安装依赖项然后你会同时运行,一切都应该正常工作。

答案 1 :(得分:0)

  • 那是因为tsc命令在代码中发现错误。如果你只在终端执行tsc,你可以看到错误并修复它。

  • 如果您只运行该应用,请移除tsc &&行中的start,最后是:

    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\",

    "start": "concurrently \"npm run tsc:w\" \"npm run lite\" ",

随着它的运作。

答案 2 :(得分:0)

很抱歉,我没有看到所有日志,concurrently: not found是因为并发模块未安装,删除node_modules文件夹并执行:

npm install

或者特别安装:

npm install -g concurrently