2016-10-13 120 views
0

我在virtualbox Linux机器构建上从头开始设置Angular 2快速入门教程。我已经照着所有的指令为5分钟快速启动的一部分,但是当我到了“故宫启动”我得到这个错误:Linux上的Angular 2 QuickStart无法正常工作

/媒体/ sf_testdev /角快速入门$ NPM启动

> [email protected] 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! [email protected] start: `tsc && concurrently "npm run tsc:w" "npm run lite" ` 
npm ERR! spawn ENOENT 
npm ERR! 
npm ERR! Failed at the [email protected] 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" 
    } 
} 

没有我曾尝试在网上似乎工作来解决。我在这里先向您的帮助表示感谢!

+0

有你在你的机器上安装了npm? –

+0

是的,当然我有npm安装 – Robert

+0

很确定我有节点6.x这个问题我不得不降级到5.x – bassxzero

回答

1

看来,当它试图运行命令同时

sh: 1: concurrently: not found

你必须运行npm install先安装依赖关系,然后你将不得不同时错误是,一切都应该正常工作。

+0

同时安装并且我已经运行npm install – Robert

+0

我以为命令“npm start”会自动调用“npm安装“时有一些错过的依赖关系。看起来我们必须单独运行每个命令,无论如何,首先运行“npm install”是一个很好的提示。谢谢! – MChaker

+0

start只是您在package.json中设置的脚本。你可以放任何东西,例如npm start可以运行'npm uninstall'。在他的例子中,你看看package.json中的脚本,它正在启动lite服务器和打字稿编译器。 –

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

  • 如果你只运行应用程序删除tsc &&start线,终于这是因为:

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

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

随着它的作品。

+0

我已经试过这个,它没有工作。 – Robert

0

对不起,我没有看到所有的日志,concurrently: not found是因为同时模块无法安装,删除node_modules文件夹,并执行:

npm install 

或特别同时进行安装:

npm install -g concurrently