Angular2 beta 15 npm启动错误

时间:2016-04-18 18:00:44

标签: node.js npm angular

我在尝试启动Angular2的快速启动应用程序时遇到了问题。

node -v
5.10.1

npm -v
3.8.6

我在MAC OS X上使用EL CAPTAIN。

tsconfig.json:

{
  "compilerOptions": {
    "target": "es5",
    "module": "system",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  },
  "exclude": [
    "node_modules",
    "typings/main",
    "typings/main.d.ts"
  ]
}

Packages.json:

{
  "name": "angular2-quickstart",
  "version": "1.0.0",
  "scripts": {
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "lite": "lite-server",
    "typings": "typings",
    "postinstall": "typings install"
  },
  "license": "ISC",
  "dependencies": {
    "angular2": "2.0.0-beta.15",
    "systemjs": "0.19.26",
    "es6-shim": "^0.35.0",
    "reflect-metadata": "0.1.2",
    "rxjs": "5.0.0-beta.2",
    "zone.js": "0.6.10"
  },
  "devDependencies": {
    "concurrently": "^2.0.0",
    "lite-server": "^2.2.0",
    "typescript": "^1.8.10",
    "typings":"^0.7.12"
  }
}

NPM安装:

npm WARN lifecycle angular2-quickstart@1.0.0~postinstall: cannot run in wd %s %s (wd=%s) angular2-quickstart@1.0.0 typings install /Users/vincentDMG/Documents/Git/angular2-tour-of-heroes
- ansi-escapes@1.4.0 node_modules/ansi-escapes
- cli-width@2.1.0 node_modules/cli-width
- exit-hook@1.1.1 node_modules/exit-hook
- figures@1.5.0 node_modules/figures
- ansi-regex@2.0.0 node_modules/inquirer/node_modules/ansi-regex
- ansi-styles@2.2.1 node_modules/inquirer/node_modules/ansi-styles
- has-ansi@2.0.0 node_modules/inquirer/node_modules/has-ansi
- lodash@4.11.1 node_modules/inquirer/node_modules/lodash
- strip-ansi@3.0.1 node_modules/inquirer/node_modules/strip-ansi
- supports-color@2.0.0 node_modules/inquirer/node_modules/supports-color
- chalk@1.1.3 node_modules/inquirer/node_modules/chalk
- ansi-regex@2.0.0 node_modules/insight/node_modules/ansi-regex
- ansi-styles@2.2.1 node_modules/insight/node_modules/ansi-styles
- has-ansi@2.0.0 node_modules/insight/node_modules/has-ansi
- strip-ansi@3.0.1 node_modules/insight/node_modules/strip-ansi
- supports-color@2.0.0 node_modules/insight/node_modules/supports-color
- chalk@1.1.3 node_modules/insight/node_modules/chalk
- lodash._getnative@3.9.1 node_modules/lodash._getnative
- lodash.debounce@3.1.1 node_modules/lodash.debounce
- mute-stream@0.0.5 node_modules/mute-stream
- onetime@1.1.0 node_modules/onetime
- osx-release@1.1.0 node_modules/osx-release
- readline2@1.0.1 node_modules/readline2
- restore-cursor@1.0.1 node_modules/restore-cursor
- cli-cursor@1.0.2 node_modules/cli-cursor
- run-async@0.1.0 node_modules/run-async
- rx-lite@3.1.2 node_modules/rx-lite
- through@2.3.8 node_modules/through
- inquirer@0.12.0 node_modules/inquirer
minimist@0.0.8 node_modules/update-notifier/node_modules/minimist -> node_modules/typings-core/node_modules/minimist
mkdirp@0.5.1 node_modules/typings/node_modules/mkdirp -> node_modules/typings-core/node_modules/mkdirp
- minimist@0.0.8 node_modules/typings/node_modules/mkdirp/node_modules/minimist
- typescript@1.8.7 node_modules/typings/node_modules/typescript
- mkdirp@0.5.1 node_modules/update-notifier/node_modules/mkdirp
- configstore@2.0.0 node_modules/update-notifier/node_modules/configstore
- win-release@1.1.1 node_modules/win-release
- os-name@1.0.3 node_modules/os-name
- elegant-spinner@1.0.1 node_modules/elegant-spinner
- es6-module-loader@0.17.11 node_modules/es6-module-loader
- insight@0.7.0 node_modules/insight
- cli-width@1.1.1 node_modules/insight/node_modules/cli-width
- inquirer@0.10.1 node_modules/insight/node_modules/inquirer
- lodash@3.10.1 node_modules/insight/node_modules/lodash
- log-update@1.0.2 node_modules/log-update
angular2-quickstart@1.0.0 /Users/vincentDMG/Documents/Git/angular2-tour-of-heroes
├── concurrently@2.0.0 
├── systemjs@0.19.26 
└─┬ typings@0.7.12 
  └─┬ typings-core@0.2.16 
    ├── configstore@2.0.0 
    ├── popsicle@5.0.1 
    ├── popsicle-retry@2.0.0 
    ├── throat@2.0.2 
    └── typescript@1.8.9 

npm WARN angular2-quickstart@1.0.0 No description
npm WARN angular2-quickstart@1.0.0 No repository field.

npm start:

    > angular2-quickstart@1.0.0 start /Users/vincentDMG/Documents/Git/angular2-tour-of-heroes
> tsc && concurrently "npm run tsc:w" "npm run lite" 

typings/browser/ambient/es6-shim/es6-shim.d.ts(8,14): error TS2300: Duplicate identifier 'PropertyKey'.
typings/browser/ambient/es6-shim/es6-shim.d.ts(11,5): error TS2300: Duplicate identifier 'done'.
typings/browser/ambient/es6-shim/es6-shim.d.ts(12,5): error TS2300: Duplicate identifier 'value'.
typings/browser/ambient/es6-shim/es6-shim.d.ts(250,5): error TS2300: Duplicate identifier 'EPSILON'.
typings/browser/ambient/es6-shim/es6-shim.d.ts(285,5): error TS2300: Duplicate identifier 'MAX_SAFE_INTEGER'.
typings/browser/ambient/es6-shim/es6-shim.d.ts(292,5): error TS2300: Duplicate identifier 'MIN_SAFE_INTEGER'.
typings/browser/ambient/es6-shim/es6-shim.d.ts(348,5): error TS2300: Duplicate identifier 'flags'.
typings/browser/ambient/es6-shim/es6-shim.d.ts(500,5): error TS2300: Duplicate identifier 'prototype'.
typings/browser/ambient/es6-shim/es6-shim.d.ts(563,5): error TS2300: Duplicate identifier 'size'.
typings/browser/ambient/es6-shim/es6-shim.d.ts(572,5): error TS2300: Duplicate identifier 'prototype'.
typings/browser/ambient/es6-shim/es6-shim.d.ts(583,5): error TS2300: Duplicate identifier 'size'.
typings/browser/ambient/es6-shim/es6-shim.d.ts(592,5): error TS2300: Duplicate identifier 'prototype'.
typings/browser/ambient/es6-shim/es6-shim.d.ts(607,5): error TS2300: Duplicate identifier 'prototype'.
typings/browser/ambient/es6-shim/es6-shim.d.ts(621,5): error TS2300: Duplicate identifier 'prototype'.
typings/browser/ambient/es6-shim/index.d.ts(8,14): error TS2300: Duplicate identifier 'PropertyKey'.
typings/browser/ambient/es6-shim/index.d.ts(11,5): error TS2300: Duplicate identifier 'done'.
typings/browser/ambient/es6-shim/index.d.ts(12,5): error TS2300: Duplicate identifier 'value'.
typings/browser/ambient/es6-shim/index.d.ts(250,5): error TS2300: Duplicate identifier 'EPSILON'.
typings/browser/ambient/es6-shim/index.d.ts(285,5): error TS2300: Duplicate identifier 'MAX_SAFE_INTEGER'.
typings/browser/ambient/es6-shim/index.d.ts(292,5): error TS2300: Duplicate identifier 'MIN_SAFE_INTEGER'.
typings/browser/ambient/es6-shim/index.d.ts(348,5): error TS2300: Duplicate identifier 'flags'.
typings/browser/ambient/es6-shim/index.d.ts(500,5): error TS2300: Duplicate identifier 'prototype'.
typings/browser/ambient/es6-shim/index.d.ts(563,5): error TS2300: Duplicate identifier 'size'.
typings/browser/ambient/es6-shim/index.d.ts(572,5): error TS2300: Duplicate identifier 'prototype'.
typings/browser/ambient/es6-shim/index.d.ts(583,5): error TS2300: Duplicate identifier 'size'.
typings/browser/ambient/es6-shim/index.d.ts(592,5): error TS2300: Duplicate identifier 'prototype'.
typings/browser/ambient/es6-shim/index.d.ts(607,5): error TS2300: Duplicate identifier 'prototype'.
typings/browser/ambient/es6-shim/index.d.ts(621,5): error TS2300: Duplicate identifier 'prototype'.

npm ERR! Darwin 15.4.0
npm ERR! argv "/usr/local/Cellar/node/5.10.1/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v5.10.1
npm ERR! npm  v3.8.6
npm ERR! code ELIFECYCLE
npm ERR! angular2-quickstart@1.0.0 start: `tsc && concurrently "npm run tsc:w" "npm run lite" `
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the angular2-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 angular2-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 angular2-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular2-quickstart
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/vincentDMG/Documents/Git/angular2-tour-of-heroes/npm-debug.log

我有node.js和NPM的最后一个版本,我的包来自angular.io网站。最后一个版本是快速入门。

你能帮我吗?

谢谢!

3 个答案:

答案 0 :(得分:1)

看起来你npm install出错了。请参阅下一个错误。

npm WARN lifecycle angular2-quickstart@1.0.0~postinstall: cannot run in wd %s %s (wd=%s) angular2-quickstart@1.0.0 typings install /Users/vincentDMG/Documents/Git/angular2-tour-of-heroes

您可以执行的是运行命令typings install。输出应该看起来像。

> typings install
├── es6-shim (ambient)
└── jasmine (ambient)

答案 1 :(得分:0)

你有定义冲突。检查定义引用(以/// <reference path="开头的注释)并确保不包含提供相同polyfill的不同库的定义。

答案 2 :(得分:0)

我遇到了同样的问题,它与我的企业代理有关。 在项目文件夹中添加了public static Vector2 OffsetByRotation(Vector2 childPos, Vector2 parentPos, float angle) { var relativeVector = childPos - parentPos; relativeVector = Rotate(relativeVector, angle); return parentPos + relativeVector; } 文件,并修复了以下内容。

.typingsrc

不幸的是打字:^ 1.0.4似乎没有使用$ http_proxy env var :( 至少在我的码头工人容器内设置了我的。