Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reflect-metadata shim is required when using class decorators #124

Open
playground opened this issue Feb 4, 2016 · 2 comments
Open

reflect-metadata shim is required when using class decorators #124

playground opened this issue Feb 4, 2016 · 2 comments

Comments

@playground
Copy link

I'm looking for example using karma runner + ng2.+ jspm + systemjs + gulp

What am I doing wrong?
Uncaught reflect-metadata shim is required when using class decorators

Thanks in advance.

[[21:50:55] Using gulpfile ~/git_repo/sandbox/angular2-unit-testing/gulpfile.js
[21:50:55] Starting 'test-dev'...
[2016-02-04 21:50:55.655] [DEBUG] config - Loading config /git_repo/sandbox/wu/angular2-unit-testing/karma.config.js
04 02 2016 21:50:56.832:WARN [karma]: No captured browser, open http://localhost:9876/
04 02 2016 21:50:56.852:INFO [karma]: Karma v0.13.19 server started at http://localhost:9876/
04 02 2016 21:50:56.855:INFO [launcher]: Starting browser Chrome
04 02 2016 21:50:57.672:INFO [Chrome 48.0.2564 (Mac OS X 10.11.2)]: Connected on socket /#yEu9wl9QqZUKYoLmAAAA with id 27138055
Chrome 48.0.2564 (Mac OS X 10.11.2) ERROR
Uncaught Uncaught Uncaught Uncaught Uncaught Uncaught reflect-metadata shim is required when using class decorators
Evaluating /git_repo/sandbox/angular2-unit-testing/jspm_packages/npm/[email protected]/src/core/util/decorators.js
Evaluating /git_repo/sandbox/angular2-unit-testing/jspm_packages/npm/[email protected]/src/core/di/decorators.js
Evaluating /git_repo/sandbox/angular2-unit-testing/jspm_packages/npm/[email protected]/src/core/di.js
Evaluating /git_repo/sandbox/angular2-unit-testing/jspm_packages/npm/[email protected]/src/core/metadata/di.js
Evaluating /git_repo/sandbox/angular2-unit-testing/jspm_packages/npm/[email protected]/src/core/metadata.js
Evaluating /git_repo/sandbox/angular2-unit-testing/jspm_packages/npm/[email protected]/core.js
Error loading /git_repo/sandbox/angular2-unit-testing/src/app/services/test/init-caps-pipe.spec.js

Here is my karma.config.js

module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['systemjs', 'jspm', 'jasmine'],
plugins:[
"karma-jspm",
'karma-jasmine',
'karma-chrome-launcher',
"karma-systemjs"
],
systemjs: {
configFile: "config.js",
config: {
paths: {
'systemjs': 'node_modules/systemjs/dist/system.src.js',
'system-polyfills': 'node_modules/systemjs/dist/system-polyfills.src.js',
'typescript': 'node_modules/typescript/lib/typescript.js',
'es6-module-loader': 'node_modules/es6-module-loader/dist/es6-module-loader.js',
'reflect-metadata': 'jspm_packages/npm/[email protected]/Refect.js'
}
}
},
files: [
'src//*.spec.js'
],
jspm: {
loadFiles: ['src/
/.spec.js'],
serveFiles: ['src/__/
.js']
} ,
proxies : { // avoid Karma's ./base virtual directory
//'/src/': '/base/src/',
//'/test/': '/base/test/',
//'/jspm_packages/': '/base/jspm_packages/'
},
reporters: ['progress'],
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
browsers: ['Chrome']
})
}

config.js

System.config({
baseURL: "/",
defaultJSExtensions: true,
transpiler: "typescript",
paths: {
"npm:": "jspm_packages/npm/",
"github:": "jspm_packages/github/"
},

packages: {
"src": {
"defaultExtension": "js"
}
},
map: {
"angular2": "npm:[email protected]",
"css": "github:systemjs/[email protected]",
"es6-shim": "github:es-shims/[email protected]",
"reflect-metadata": "npm:[email protected]",
"typescript": "npm:[email protected]",
"zone.js": "npm:[email protected]",
"github:jspm/[email protected]": {
"assert": "npm:[email protected]"
},
"github:jspm/[email protected]": {
"buffer": "npm:[email protected]"
},
"github:jspm/[email protected]": {
"constants-browserify": "npm:[email protected]"
},
"github:jspm/[email protected]": {
"crypto-browserify": "npm:[email protected]"
},
"github:jspm/[email protected]": {
"events": "npm:[email protected]"
},
"github:jspm/[email protected]": {
"path-browserify": "npm:[email protected]"
},
"github:jspm/[email protected]": {
"process": "npm:[email protected]"
},
"github:jspm/[email protected]": {
"stream-browserify": "npm:[email protected]"
},
"github:jspm/[email protected]": {
"string_decoder": "npm:[email protected]"
},
"github:jspm/[email protected]": {
"util": "npm:[email protected]"
},
"github:jspm/[email protected]": {
"vm-browserify": "npm:[email protected]"
},
"npm:[email protected]": {
"crypto": "github:jspm/[email protected]",
"es6-promise": "npm:[email protected]",
"es6-shim": "npm:[email protected]",
"process": "github:jspm/[email protected]",
"reflect-metadata": "npm:[email protected]",
"rxjs": "npm:[email protected]",
"zone.js": "npm:[email protected]"
},
"npm:[email protected]": {
"assert": "github:jspm/[email protected]",
"bn.js": "npm:[email protected]",
"buffer": "github:jspm/[email protected]",
"inherits": "npm:[email protected]",
"minimalistic-assert": "npm:[email protected]",
"vm": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"util": "npm:[email protected]"
},
"npm:[email protected]": {
"buffer": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"buffer": "github:jspm/[email protected]",
"buffer-xor": "npm:[email protected]",
"cipher-base": "npm:[email protected]",
"create-hash": "npm:[email protected]",
"crypto": "github:jspm/[email protected]",
"evp_bytestokey": "npm:[email protected]",
"fs": "github:jspm/[email protected]",
"inherits": "npm:[email protected]",
"systemjs-json": "github:systemjs/[email protected]"
},
"npm:[email protected]": {
"browserify-aes": "npm:[email protected]",
"browserify-des": "npm:[email protected]",
"buffer": "github:jspm/[email protected]",
"crypto": "github:jspm/[email protected]",
"evp_bytestokey": "npm:[email protected]"
},
"npm:[email protected]": {
"buffer": "github:jspm/[email protected]",
"cipher-base": "npm:[email protected]",
"crypto": "github:jspm/[email protected]",
"des.js": "npm:[email protected]",
"inherits": "npm:[email protected]"
},
"npm:[email protected]": {
"bn.js": "npm:[email protected]",
"buffer": "github:jspm/[email protected]",
"constants": "github:jspm/[email protected]",
"crypto": "github:jspm/[email protected]",
"randombytes": "npm:[email protected]"
},
"npm:[email protected]": {
"bn.js": "npm:[email protected]",
"browserify-rsa": "npm:[email protected]",
"buffer": "github:jspm/[email protected]",
"create-hash": "npm:[email protected]",
"create-hmac": "npm:[email protected]",
"crypto": "github:jspm/[email protected]",
"elliptic": "npm:[email protected]",
"inherits": "npm:[email protected]",
"parse-asn1": "npm:[email protected]",
"stream": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"buffer": "github:jspm/[email protected]",
"systemjs-json": "github:systemjs/[email protected]"
},
"npm:[email protected]": {
"base64-js": "npm:[email protected]",
"child_process": "github:jspm/[email protected]",
"fs": "github:jspm/[email protected]",
"ieee754": "npm:[email protected]",
"isarray": "npm:[email protected]",
"process": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"buffer": "github:jspm/[email protected]",
"inherits": "npm:[email protected]",
"stream": "github:jspm/[email protected]",
"string_decoder": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"systemjs-json": "github:systemjs/[email protected]"
},
"npm:[email protected]": {
"buffer": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"bn.js": "npm:[email protected]",
"buffer": "github:jspm/[email protected]",
"crypto": "github:jspm/[email protected]",
"elliptic": "npm:[email protected]"
},
"npm:[email protected]": {
"buffer": "github:jspm/[email protected]",
"cipher-base": "npm:[email protected]",
"crypto": "github:jspm/[email protected]",
"fs": "github:jspm/[email protected]",
"inherits": "npm:[email protected]",
"ripemd160": "npm:[email protected]",
"sha.js": "npm:[email protected]"
},
"npm:[email protected]": {
"buffer": "github:jspm/[email protected]",
"create-hash": "npm:[email protected]",
"crypto": "github:jspm/[email protected]",
"inherits": "npm:[email protected]",
"stream": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"browserify-cipher": "npm:[email protected]",
"browserify-sign": "npm:[email protected]",
"create-ecdh": "npm:[email protected]",
"create-hash": "npm:[email protected]",
"create-hmac": "npm:[email protected]",
"diffie-hellman": "npm:[email protected]",
"inherits": "npm:[email protected]",
"pbkdf2": "npm:[email protected]",
"public-encrypt": "npm:[email protected]",
"randombytes": "npm:[email protected]"
},
"npm:[email protected]": {
"buffer": "github:jspm/[email protected]",
"inherits": "npm:[email protected]",
"minimalistic-assert": "npm:[email protected]"
},
"npm:[email protected]": {
"bn.js": "npm:[email protected]",
"buffer": "github:jspm/[email protected]",
"crypto": "github:jspm/[email protected]",
"miller-rabin": "npm:[email protected]",
"randombytes": "npm:[email protected]",
"systemjs-json": "github:systemjs/[email protected]"
},
"npm:[email protected]": {
"bn.js": "npm:[email protected]",
"brorand": "npm:[email protected]",
"hash.js": "npm:[email protected]",
"inherits": "npm:[email protected]",
"systemjs-json": "github:systemjs/[email protected]"
},
"npm:[email protected]": {
"process": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"process": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"buffer": "github:jspm/[email protected]",
"create-hash": "npm:[email protected]",
"crypto": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"inherits": "npm:[email protected]"
},
"npm:[email protected]": {
"util": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"bn.js": "npm:[email protected]",
"brorand": "npm:[email protected]"
},
"npm:[email protected]": {
"asn1.js": "npm:[email protected]",
"browserify-aes": "npm:[email protected]",
"buffer": "github:jspm/[email protected]",
"create-hash": "npm:[email protected]",
"evp_bytestokey": "npm:[email protected]",
"pbkdf2": "npm:[email protected]",
"systemjs-json": "github:systemjs/[email protected]"
},
"npm:[email protected]": {
"process": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"buffer": "github:jspm/[email protected]",
"child_process": "github:jspm/[email protected]",
"create-hmac": "npm:[email protected]",
"crypto": "github:jspm/[email protected]",
"path": "github:jspm/[email protected]",
"process": "github:jspm/[email protected]",
"systemjs-json": "github:systemjs/[email protected]"
},
"npm:[email protected]": {
"assert": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"bn.js": "npm:[email protected]",
"browserify-rsa": "npm:[email protected]",
"buffer": "github:jspm/[email protected]",
"create-hash": "npm:[email protected]",
"crypto": "github:jspm/[email protected]",
"parse-asn1": "npm:[email protected]",
"randombytes": "npm:[email protected]"
},
"npm:[email protected]": {
"buffer": "github:jspm/[email protected]",
"crypto": "github:jspm/[email protected]",
"process": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"buffer": "github:jspm/[email protected]",
"core-util-is": "npm:[email protected]",
"events": "github:jspm/[email protected]",
"inherits": "npm:[email protected]",
"isarray": "npm:[email protected]",
"process": "github:jspm/[email protected]",
"stream-browserify": "npm:[email protected]",
"string_decoder": "npm:[email protected]"
},
"npm:[email protected]": {
"assert": "github:jspm/[email protected]",
"process": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"assert": "github:jspm/[email protected]",
"process": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"buffer": "github:jspm/[email protected]",
"process": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"buffer": "github:jspm/[email protected]",
"process": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"buffer": "github:jspm/[email protected]",
"fs": "github:jspm/[email protected]",
"inherits": "npm:[email protected]",
"process": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"events": "github:jspm/[email protected]",
"inherits": "npm:[email protected]",
"readable-stream": "npm:[email protected]"
},
"npm:[email protected]": {
"buffer": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"inherits": "npm:[email protected]",
"process": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"indexof": "npm:[email protected]"
},
"npm:[email protected]": {
"es6-promise": "npm:[email protected]",
"process": "github:jspm/[email protected]"
},
"npm:[email protected]": {
"es6-promise": "npm:[email protected]",
"process": "github:jspm/[email protected]"
}
}
});

@playground playground changed the title SystemJS not found, karma + ng2.+ jspm + systemjs + gulp reflect-metadata shim is required when using class decorators Feb 5, 2016
@playground
Copy link
Author

Adding
includeFiles: [
'jspm_packages/npm/[email protected]/Reflect.js'
],
fix the reflect-metadata shim is required error.

@pxwise
Copy link

pxwise commented May 27, 2016

Funny, I googled my way here. 😄

jspm is throwing errors for me when looking up crypto.js while resolving reflect-metadata.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants