1

それで、私は数日前から学習しようとしていAngular 2ます(Github Repo)。単体テストのために、私は構成Jasmineを試みてきましKarmaた. 私はこれらのプロジェクトをベースとしてフォローしてきました

1) Karma と Jasmine で Angular 2 をテストする

2) Angular2 アプリケーションのシード

ただし、いくつかの理由で、構成が正しくありません。フロントエンド開発の経験不足が原因である可能性があります。

最初に、次のメッセージでエラーが発生しました。

node_modules/angular2/platform/browser.d.ts(77,90): error TS2304: Cannot find name 'Promise'.

ここに投稿された同様の問題を見つけ、ここ に記載されている解決策に従いました

ただし、次のエラーが表示されます。

node_modules/rxjs/Observable.d.ts(1,1): error TS2654: Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition.
node_modules/rxjs/Observable.d.ts(12,6): error TS2304: Cannot find name 'Symbol'.
node_modules/rxjs/Observable.d.ts(15,42): error TS2304: Cannot find name 'Iterable'.

このエラーについては、説得力のある解決策が見つかりませんでした。それで、誰かが私を手伝ってくれますか?

前もって感謝します。

構成の詳細:

1) パッケージ.json

{
  "name": "learning",
  "version": "1.0.0",
  "description": "Learning Angular 2",
  "main": "index.js",
  "scripts": {
    "build": "rm -rf dist && tsc -p src/",
    "start": "tsc && concurrently \"npm run tsc:w\" \"http-server -c-1 -o -p 8875 .\" ",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "pretest": "npm run build",
    "test": "karma start karma.conf.js",
    "posttest": "node_modules/.bin/remap-istanbul -i coverage/coverage-final.json -o coverage -t html",
    "coverage": "http-server -c-1 -o -p 9875 ./coverage",
    "typings": "typings",
    "postinstall": "typings install"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "angular2": "^2.0.0-beta.14",
    "es6-promise": "^3.1.2",
    "es6-shim": "^0.35.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "^5.0.0-beta.5",
    "zone.js": "^0.6.10"
  },
  "devDependencies": {
    "concurrently": "^2.0.0",
    "http-server": "^0.9.0",
    "jasmine-core": "^2.4.1",
    "karma": "^0.13.22",
    "karma-chrome-launcher": "^0.2.3",
    "karma-coverage": "^0.5.5",
    "karma-jasmine": "^0.3.8",
    "remap-istanbul": "^0.5.1",
    "systemjs": "^0.19.25",
    "typescript": "^1.8.9",
    "typings":"^0.7.12"
  }
}

2) tsconfig.json

{
  "compilerOptions": {
    "target": "ES5",
    "module": "commonjs",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "sourceMap": true,
    "removeComments": true,
    "declaration": true,
    "outDir": "../dist"
  },
  "exclude": [
    "node_modules"
  ]
}
4

2 に答える 2

2

rxjs bet 5 のバグです。ベータ 6 を待つか、使用して 4 にダウングレードします。

 npm install rxjs@5.0.0-beta.4 --save.
于 2016-04-12T13:04:18.540 に答える