使用jspm配置运行typescript angular2 app的页面加载时出错

时间:2016-02-29 23:17:38

标签: javascript typescript angular rxjs jspm

我有一个小的angular2应用程序,可以观察到一些基本的http交互。

我能够在正常的节点设置中正常运行应用程序。

我正在尝试将应用程序配置为使用jspm配置文件。

但是,当页面加载时,我得到几个无法加载rxjs模块周围的资源错误。

if(value==null){throw new NullPointerException

以下是我的jspm-config和package.json

Failed to load resource: the server responded with a status of 404 (Not Found)
...localhost:3002/jspm_packages/npm/rxjs@5.0.0-beta.2/observable/.js Failed to load resource: the server responded with a status of 404 (Not Found)...localhost:3002/jspm_packages/npm/rxjs@5.0.0-beta.2/operator/.js Failed to load resource: the server responded with a status of 404 (Not Found)
system.js:4 Uncaught (in promise) Error: XHR error (404 Not Found) loading ...localhost:3002/jspm_packages/npm/rxjs@5.0.0-beta.2/subject/.js(…)
...localhost:3002/jspm_packages/npm/rxjs@5.0.0-beta.2/observable/.js Failed to load resource: the server responded with a status of 404 (Not Found)

这是package.json文件。

System.config({
baseURL: "./",
defaultJSExtensions: true,
transpiler: false,
paths: {
"github:*": "jspm_packages/github/*",
"npm:*": "jspm_packages/npm/*",
"app": "dist/app"
},

packages: {
"app": {
  "format": "register",
   defaultJSExtensions: true
}
},

map: {
"angular2": "npm:angular2@2.0.0-beta.7",
"d3": "npm:d3@3.5.16",
"es6-promise": "npm:es6-promise@3.1.2",
"es6-shim": "github:es-shims/es6-shim@0.34.2",
"lodash": "npm:lodash@4.5.0",
"process": "npm:process@0.11.2",
"reflect-metadata": "npm:reflect-metadata@0.1.3",
"rxjs": "npm:rxjs@5.0.0-beta.2",
"zone.js": "npm:zone.js@0.5.15",
"github:jspm/nodelibs-assert@0.1.0": {
  "assert": "npm:assert@1.3.0"
},
"github:jspm/nodelibs-buffer@0.1.0": {
  "buffer": "npm:buffer@3.6.0"
},
"github:jspm/nodelibs-constants@0.1.0": {
  "constants-browserify": "npm:constants-browserify@0.0.1"
},
"github:jspm/nodelibs-crypto@0.1.0": {
  "crypto-browserify": "npm:crypto-browserify@3.11.0"
},
"github:jspm/nodelibs-events@0.1.1": {
  "events": "npm:events@1.0.2"
},
"github:jspm/nodelibs-path@0.1.0": {
  "path-browserify": "npm:path-browserify@0.0.0"
},
"github:jspm/nodelibs-process@0.1.2": {
  "process": "npm:process@0.11.2"
},
"github:jspm/nodelibs-stream@0.1.0": {
  "stream-browserify": "npm:stream-browserify@1.0.0"
},
"github:jspm/nodelibs-string_decoder@0.1.0": {
  "string_decoder": "npm:string_decoder@0.10.31"
},
"github:jspm/nodelibs-util@0.1.0": {
  "util": "npm:util@0.10.3"
},
"github:jspm/nodelibs-vm@0.1.0": {
  "vm-browserify": "npm:vm-browserify@0.0.4"
},
"npm:angular2@2.0.0-beta.7": {
  "crypto": "github:jspm/nodelibs-crypto@0.1.0",
  "es6-promise": "npm:es6-promise@3.1.2",
  "es6-shim": "npm:es6-shim@0.33.13",
  "process": "github:jspm/nodelibs-process@0.1.2",
  "reflect-metadata": "npm:reflect-metadata@0.1.2",
  "rxjs": "npm:rxjs@5.0.0-beta.2",
  "zone.js": "npm:zone.js@0.5.15"
},
"npm:asn1.js@4.5.0": {
  "assert": "github:jspm/nodelibs-assert@0.1.0",
  "bn.js": "npm:bn.js@4.10.3",
  "buffer": "github:jspm/nodelibs-buffer@0.1.0",
  "fs": "github:jspm/nodelibs-fs@0.1.2",
  "inherits": "npm:inherits@2.0.1",
  "minimalistic-assert": "npm:minimalistic-assert@1.0.0",
  "vm": "github:jspm/nodelibs-vm@0.1.0"
},
"npm:assert@1.3.0": {
  "util": "npm:util@0.10.3"
},
"npm:bn.js@4.10.3": {
  "buffer": "github:jspm/nodelibs-buffer@0.1.0"
},
"npm:browserify-aes@1.0.6": {
  "buffer": "github:jspm/nodelibs-buffer@0.1.0",
  "buffer-xor": "npm:buffer-xor@1.0.3",
  "cipher-base": "npm:cipher-base@1.0.2",
  "create-hash": "npm:create-hash@1.1.2",
  "crypto": "github:jspm/nodelibs-crypto@0.1.0",
  "evp_bytestokey": "npm:evp_bytestokey@1.0.0",
  "fs": "github:jspm/nodelibs-fs@0.1.2",
  "inherits": "npm:inherits@2.0.1",
  "systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:browserify-cipher@1.0.0": {
  "browserify-aes": "npm:browserify-aes@1.0.6",
  "browserify-des": "npm:browserify-des@1.0.0",
  "buffer": "github:jspm/nodelibs-buffer@0.1.0",
  "crypto": "github:jspm/nodelibs-crypto@0.1.0",
  "evp_bytestokey": "npm:evp_bytestokey@1.0.0"
},
"npm:browserify-des@1.0.0": {
  "buffer": "github:jspm/nodelibs-buffer@0.1.0",
  "cipher-base": "npm:cipher-base@1.0.2",
  "crypto": "github:jspm/nodelibs-crypto@0.1.0",
  "des.js": "npm:des.js@1.0.0",
  "inherits": "npm:inherits@2.0.1"
},
"npm:browserify-rsa@4.0.0": {
  "bn.js": "npm:bn.js@4.10.3",
  "buffer": "github:jspm/nodelibs-buffer@0.1.0",
  "constants": "github:jspm/nodelibs-constants@0.1.0",
  "crypto": "github:jspm/nodelibs-crypto@0.1.0",
  "randombytes": "npm:randombytes@2.0.2"
},
"npm:browserify-sign@4.0.0": {
  "bn.js": "npm:bn.js@4.10.3",
  "browserify-rsa": "npm:browserify-rsa@4.0.0",
  "buffer": "github:jspm/nodelibs-buffer@0.1.0",
  "create-hash": "npm:create-hash@1.1.2",
  "create-hmac": "npm:create-hmac@1.1.4",
  "crypto": "github:jspm/nodelibs-crypto@0.1.0",
  "elliptic": "npm:elliptic@6.2.3",
  "inherits": "npm:inherits@2.0.1",
  "parse-asn1": "npm:parse-asn1@5.0.0",
  "stream": "github:jspm/nodelibs-stream@0.1.0"
},
"npm:buffer-xor@1.0.3": {
  "buffer": "github:jspm/nodelibs-buffer@0.1.0",
  "systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:buffer@3.6.0": {
  "base64-js": "npm:base64-js@0.0.8",
  "child_process": "github:jspm/nodelibs-child_process@0.1.0",
  "fs": "github:jspm/nodelibs-fs@0.1.2",
  "ieee754": "npm:ieee754@1.1.6",
  "isarray": "npm:isarray@1.0.0",
  "process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:cipher-base@1.0.2": {
  "buffer": "github:jspm/nodelibs-buffer@0.1.0",
  "inherits": "npm:inherits@2.0.1",
  "stream": "github:jspm/nodelibs-stream@0.1.0",
  "string_decoder": "github:jspm/nodelibs-string_decoder@0.1.0"
},
"npm:constants-browserify@0.0.1": {
  "systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:core-util-is@1.0.2": {
  "buffer": "github:jspm/nodelibs-buffer@0.1.0"
},
"npm:create-ecdh@4.0.0": {
  "bn.js": "npm:bn.js@4.10.3",
  "buffer": "github:jspm/nodelibs-buffer@0.1.0",
  "crypto": "github:jspm/nodelibs-crypto@0.1.0",
  "elliptic": "npm:elliptic@6.2.3"
},
"npm:create-hash@1.1.2": {
  "buffer": "github:jspm/nodelibs-buffer@0.1.0",
  "cipher-base": "npm:cipher-base@1.0.2",
  "crypto": "github:jspm/nodelibs-crypto@0.1.0",
  "fs": "github:jspm/nodelibs-fs@0.1.2",
  "inherits": "npm:inherits@2.0.1",
  "ripemd160": "npm:ripemd160@1.0.1",
  "sha.js": "npm:sha.js@2.4.4"
},
"npm:create-hmac@1.1.4": {
  "buffer": "github:jspm/nodelibs-buffer@0.1.0",
  "create-hash": "npm:create-hash@1.1.2",
  "crypto": "github:jspm/nodelibs-crypto@0.1.0",
  "inherits": "npm:inherits@2.0.1",
  "stream": "github:jspm/nodelibs-stream@0.1.0"
},
"npm:crypto-browserify@3.11.0": {
  "browserify-cipher": "npm:browserify-cipher@1.0.0",
  "browserify-sign": "npm:browserify-sign@4.0.0",
  "create-ecdh": "npm:create-ecdh@4.0.0",
  "create-hash": "npm:create-hash@1.1.2",
  "create-hmac": "npm:create-hmac@1.1.4",
  "diffie-hellman": "npm:diffie-hellman@5.0.2",
  "inherits": "npm:inherits@2.0.1",
  "pbkdf2": "npm:pbkdf2@3.0.4",
  "public-encrypt": "npm:public-encrypt@4.0.0",
  "randombytes": "npm:randombytes@2.0.2"
},
"npm:des.js@1.0.0": {
  "buffer": "github:jspm/nodelibs-buffer@0.1.0",
  "inherits": "npm:inherits@2.0.1",
  "minimalistic-assert": "npm:minimalistic-assert@1.0.0"
},
"npm:diffie-hellman@5.0.2": {
  "bn.js": "npm:bn.js@4.10.3",
  "buffer": "github:jspm/nodelibs-buffer@0.1.0",
  "crypto": "github:jspm/nodelibs-crypto@0.1.0",
  "miller-rabin": "npm:miller-rabin@4.0.0",
  "randombytes": "npm:randombytes@2.0.2",
  "systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:elliptic@6.2.3": {
  "bn.js": "npm:bn.js@4.10.3",
  "brorand": "npm:brorand@1.0.5",
  "hash.js": "npm:hash.js@1.0.3",
  "inherits": "npm:inherits@2.0.1",
  "systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:es6-promise@3.1.2": {
  "process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:es6-shim@0.33.13": {
  "process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:evp_bytestokey@1.0.0": {
  "buffer": "github:jspm/nodelibs-buffer@0.1.0",
  "create-hash": "npm:create-hash@1.1.2",
  "crypto": "github:jspm/nodelibs-crypto@0.1.0"
},
"npm:hash.js@1.0.3": {
  "inherits": "npm:inherits@2.0.1"
},
"npm:inherits@2.0.1": {
  "util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:lodash@4.5.0": {
  "buffer": "github:jspm/nodelibs-buffer@0.1.0",
  "process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:miller-rabin@4.0.0": {
  "bn.js": "npm:bn.js@4.10.3",
  "brorand": "npm:brorand@1.0.5"
},
"npm:parse-asn1@5.0.0": {
  "asn1.js": "npm:asn1.js@4.5.0",
  "browserify-aes": "npm:browserify-aes@1.0.6",
  "buffer": "github:jspm/nodelibs-buffer@0.1.0",
  "create-hash": "npm:create-hash@1.1.2",
  "evp_bytestokey": "npm:evp_bytestokey@1.0.0",
  "pbkdf2": "npm:pbkdf2@3.0.4",
  "systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:path-browserify@0.0.0": {
  "process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:pbkdf2@3.0.4": {
  "buffer": "github:jspm/nodelibs-buffer@0.1.0",
  "child_process": "github:jspm/nodelibs-child_process@0.1.0",
  "create-hmac": "npm:create-hmac@1.1.4",
  "crypto": "github:jspm/nodelibs-crypto@0.1.0",
  "path": "github:jspm/nodelibs-path@0.1.0",
  "process": "github:jspm/nodelibs-process@0.1.2",
  "systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:process@0.11.2": {
  "assert": "github:jspm/nodelibs-assert@0.1.0"
},
"npm:public-encrypt@4.0.0": {
  "bn.js": "npm:bn.js@4.10.3",
  "browserify-rsa": "npm:browserify-rsa@4.0.0",
  "buffer": "github:jspm/nodelibs-buffer@0.1.0",
  "create-hash": "npm:create-hash@1.1.2",
  "crypto": "github:jspm/nodelibs-crypto@0.1.0",
  "parse-asn1": "npm:parse-asn1@5.0.0",
  "randombytes": "npm:randombytes@2.0.2"
},
"npm:randombytes@2.0.2": {
  "buffer": "github:jspm/nodelibs-buffer@0.1.0",
  "crypto": "github:jspm/nodelibs-crypto@0.1.0",
  "process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:readable-stream@1.1.13": {
  "buffer": "github:jspm/nodelibs-buffer@0.1.0",
  "core-util-is": "npm:core-util-is@1.0.2",
  "events": "github:jspm/nodelibs-events@0.1.1",
  "inherits": "npm:inherits@2.0.1",
  "isarray": "npm:isarray@0.0.1",
  "process": "github:jspm/nodelibs-process@0.1.2",
  "stream-browserify": "npm:stream-browserify@1.0.0",
  "string_decoder": "npm:string_decoder@0.10.31"
},
"npm:reflect-metadata@0.1.2": {
  "assert": "github:jspm/nodelibs-assert@0.1.0",
  "process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:reflect-metadata@0.1.3": {
  "assert": "github:jspm/nodelibs-assert@0.1.0",
  "process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:ripemd160@1.0.1": {
  "buffer": "github:jspm/nodelibs-buffer@0.1.0",
  "process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:rxjs@5.0.0-beta.2": {
  "buffer": "github:jspm/nodelibs-buffer@0.1.0",
  "process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:sha.js@2.4.4": {
  "buffer": "github:jspm/nodelibs-buffer@0.1.0",
  "fs": "github:jspm/nodelibs-fs@0.1.2",
  "inherits": "npm:inherits@2.0.1",
  "process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:stream-browserify@1.0.0": {
  "events": "github:jspm/nodelibs-events@0.1.1",
  "inherits": "npm:inherits@2.0.1",
  "readable-stream": "npm:readable-stream@1.1.13"
},
"npm:string_decoder@0.10.31": {
  "buffer": "github:jspm/nodelibs-buffer@0.1.0"
},
"npm:util@0.10.3": {
  "inherits": "npm:inherits@2.0.1",
  "process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:vm-browserify@0.0.4": {
  "indexof": "npm:indexof@0.0.1"
},
"npm:zone.js@0.5.15": {
  "es6-promise": "npm:es6-promise@3.1.2",
  "process": "github:jspm/nodelibs-process@0.1.2"
}
}
});

2 个答案:

答案 0 :(得分:1)

在此处添加指向related github issue的链接。仍然不完全清楚根本原因(可能与rxjs的错误发布有关?)。但清除npm和jspm缓存然后重新安装似乎解决了这个问题:

> npm cache clean
> jspm cache-clear

答案 1 :(得分:0)

将es7-reflect-metadata更新为1.6.0,将typescript更新为1.8.2,解决了类似的问题。只需更改package.json中的版本并运行npm install即可完成。

this解决方案之前。