Reputation:
I've been working in aurelia app and I'm getting an error while testing.
I'm trying to use aurelia-dependency-injection
which is already a dependency of other packages which I'm including via jspm
like aurelia-framework
, aurelia-router
, aurelia-templating-resources
, aurelia-templating-router
and when I try to inject it just works fine on my browser. However, when I try to test using Karma, it says
27 05 2016 09:45:18.202:WARN [web-server]: 404: /base/aurelia-dependency-injection.js
Chrome 50.0.2661 (Linux 0.0.0) ERROR
Error: XHR error (404 Not Found) loading /home/cyberkiller/test_project/aurelia-dependency-injection.js
Error loading /home/cyberkiller/test_project/aurelia-dependency-injection.js as "aurelia-dependency-injection" from /home/cyberkiller/test_project/src/users/list.ts
My package.json
has the following jspm dependencies:
"jspm": {
"dependencies": {
"aurelia-animator-css": "npm:aurelia-animator-css@^1.0.0-beta.1.1.2",
"aurelia-bootstrapper": "npm:aurelia-bootstrapper@^1.0.0-beta.1.1.4",
"aurelia-fetch-client": "npm:aurelia-fetch-client@^1.0.0-beta.1.1.1",
"aurelia-framework": "npm:aurelia-framework@^1.0.0-beta.1.1.4",
"aurelia-history-browser": "npm:aurelia-history-browser@^1.0.0-beta.1.1.4",
"aurelia-loader-default": "npm:aurelia-loader-default@^1.0.0-beta.1.1.3",
"aurelia-logging-console": "npm:aurelia-logging-console@^1.0.0-beta.1.1.4",
"aurelia-pal-browser": "npm:aurelia-pal-browser@^1.0.0-beta.1.1.4",
"aurelia-polyfills": "npm:aurelia-polyfills@^1.0.0-beta.1.0.3",
"aurelia-router": "npm:aurelia-router@^1.0.0-beta.1.1.3",
"aurelia-templating-binding": "npm:aurelia-templating-binding@^1.0.0-beta.1.1.2",
"aurelia-templating-resources": "npm:aurelia-templating-resources@^1.0.0-beta.1.1.3",
"aurelia-templating-router": "npm:aurelia-templating-router@^1.0.0-beta.1.1.2",
"bootstrap": "github:twbs/bootstrap@^3.3.5",
"fetch": "github:github/fetch@^0.11.0",
"font-awesome": "npm:font-awesome@^4.6.1",
"simple-line-icons": "npm:simple-line-icons@^2.2.4",
"text": "github:systemjs/plugin-text@^0.0.3"
},
"devDependencies": {
"babel": "npm:babel-core@^5.8.24",
"babel-runtime": "npm:babel-runtime@^5.8.24",
"core-js": "npm:core-js@^1.1.4"
}
}
I did find a workaround, which is to add aurelia-dependency-injection
explicitly as a dependency in my package.json
like
"aurelia-dependency-injection": "npm:[email protected]"
Which makes my package.json
look like:
"jspm": {
"dependencies": {
"aurelia-animator-css": "npm:aurelia-animator-css@^1.0.0-beta.1.1.2",
"aurelia-bootstrapper": "npm:aurelia-bootstrapper@^1.0.0-beta.1.1.4",
"aurelia-dependency-injection": "npm:[email protected]",
"aurelia-fetch-client": "npm:aurelia-fetch-client@^1.0.0-beta.1.1.1",
"aurelia-framework": "npm:aurelia-framework@^1.0.0-beta.1.1.4",
"aurelia-history-browser": "npm:aurelia-history-browser@^1.0.0-beta.1.1.4",
"aurelia-loader-default": "npm:aurelia-loader-default@^1.0.0-beta.1.1.3",
"aurelia-logging-console": "npm:aurelia-logging-console@^1.0.0-beta.1.1.4",
"aurelia-pal-browser": "npm:aurelia-pal-browser@^1.0.0-beta.1.1.4",
"aurelia-polyfills": "npm:aurelia-polyfills@^1.0.0-beta.1.0.3",
"aurelia-router": "npm:aurelia-router@^1.0.0-beta.1.1.3",
"aurelia-templating-binding": "npm:aurelia-templating-binding@^1.0.0-beta.1.1.2",
"aurelia-templating-resources": "npm:aurelia-templating-resources@^1.0.0-beta.1.1.3",
"aurelia-templating-router": "npm:aurelia-templating-router@^1.0.0-beta.1.1.2",
"bootstrap": "github:twbs/bootstrap@^3.3.5",
"fetch": "github:github/fetch@^0.11.0",
"font-awesome": "npm:font-awesome@^4.6.1",
"simple-line-icons": "npm:simple-line-icons@^2.2.4",
"text": "github:systemjs/plugin-text@^0.0.3"
},
"devDependencies": {
"babel": "npm:babel-core@^5.8.24",
"babel-runtime": "npm:babel-runtime@^5.8.24",
"core-js": "npm:core-js@^1.1.4"
}
}
When I update everything and build and run test, it no longer complains and it executes successfully. However I'm not sure if this is just a workaround, or the way to do it. Is there any better way to handle this?
Upvotes: 1
Views: 608