Open pierslawson opened 7 years ago
A work around from stackoverflow is to use .feature("aurelia-chart"); rather than .plugin("aurelia-chart");
http://stackoverflow.com/questions/38695467/pluginaurelia-chart-throws-404-error
This has been mentioned a few times there is a distinction between feature
and plugin
, when using feature you are telling something to load locally, if you are using plugin you are telling it to load from a module/external.
There should be an aurelia-chart.js
file within the dist/commonjs
directory which I believe is where the package.json looks. I am not sure if JSPM has done some new update which stops this stuff working but as of JSPM 16.* it was working fine (I think it was JSPM 16... its been a while since I did anything with JSPM since they went to the CLI... and no doubt one day to some other tooling :( )
No, aurelia-chart.js hasn't turned up in the dist directory. The loader tries to load jspm_packages/npm/aurelia-chart@0.2.5.js but that doesn't exist either. I've got JSPM 0.16.47 running.
Can you screenprint or tell me what is in your JSPM folder for the aurelia-chart
module?
-wwwroot
|- jspm_packages
|- npm
|- Aurelia-chart@0.2.5
|- .jspm-hash
|- index.js
|- attributes
| |- chart-attribute.js
|
|- elements
| |- chart-element.html
| |- chart-element.js
|
|- observers
|- model-observer.js
hmm that is very odd as the dist folders which the package.json should be linked to output aurelia-chart.js
after someones change to fix something along these lines before:
https://github.com/grofit/aurelia-chart/tree/master/dist/system
So to my knowledge that is what the jspm should be using, does anyone else have this issue? (I have lost weeks of my life to the aurelia tooling stuff so I am often reluctant to spend more time on it unless knowing there is a specific problem which wont somehow break it for others, which is often the case).
@grofit did you actually update the npm package after importing my pull request into github? It appears as no, can you check as the version on github is 0.2.6 (as per my pull request) but here is 0.2.5 listed.
I cannot remember, I will clone it all and give it a whirl now as there is another PR which needs to be built and released.
I think this issue could be linked as duplicate #15
Right I have done a new release, ran it all locally and it works, I did notice that for some reason it was back to being index but referencing the aurelia-chart.js, I dont remember who made that change as I think I always had it as index, anyway it should all work in 0.2.6 which is also released on NPM so please give that a try and let me know if it fixes this issue.
I'm afraid that didn't fix it. I still get a 404 as the browser tries to load jspm_packages/npm/aurelia-chart@0.2.5.js
I did get a warning as JSPM was updating the package:
jspm update npm:aurelia-chart
Looking up npm:aurelia-chart
Updating registry cache...
Downloading npm:aurelia-chart@0.2.6
Looking up npm:aurelia-framework
Looking up npm:chart.js
Looking up npm:aurelia-binding
Looking up npm:aurelia-dependency-injection
Looking up npm:aurelia-loader
Looking up npm:aurelia-logging
Looking up npm:aurelia-metadata
Looking up npm:aurelia-pal
Looking up npm:aurelia-path
Looking up npm:aurelia-task-queue
Looking up npm:aurelia-templating
Looking up npm:chartjs-color
Looking up npm:moment
Looking up npm:color-convert
Looking up npm:chartjs-color-string
Looking up npm:color-name
warn Main entry point not found for npm:aurelia-chart@0.2.6.
Adjust this property in the package.json or with an override, setting "main": false if this is the intention.
Looking up github:jspm/nodelibs-process
Looking up github:jspm/nodelibs-child_process
Looking up github:systemjs/plugin-json
Looking up github:jspm/nodelibs-buffer
Looking up npm:process
Looking up github:jspm/nodelibs-vm
Looking up github:jspm/nodelibs-assert
Looking up github:jspm/nodelibs-fs
Looking up npm:buffer
Looking up npm:base64-js
Looking up npm:ieee754
Looking up npm:isarray
Looking up npm:assert
Looking up npm:util
Looking up npm:vm-browserify
Looking up npm:indexof
Looking up npm:inherits
Looking up github:jspm/nodelibs-util
ok Installed aurelia-chart as npm:aurelia-chart@^0.2.5 (0.2.6)
Clearing configuration for npm:aurelia-chart@0.2.5
Removing package files for npm:aurelia-chart@0.2.5
ok Install tree has no forks.
ok Install complete.
@pierslawson can you try to install from my repo just for test: "jspm install github:urosg80/aurelia-chart" as this was working before.
AH ok, so can anyone confirm does JSPM need its OWN main
section in the package.json as there is a default npm main entry point and I thought JSPM used the same one.
https://github.com/grofit/aurelia-chart/blob/master/package.json#L13
There is the one for the latest version so as you can see there is a main in there that references the correct file.
I am guessing that the problem is in the "index.js" file names as when I was testing for my fix only after renaming the index.js files to aurelia-chart.js and fixing the references then JSPM installation worked.
ah so it was you who renamed them, I couldnt care less what the names were, but when I pulled latest and gulped it renamed them all back to index and it seemed ok.
@urosg80 I tried your branch as suggested and get the same issue when trying the use.plugin call as opposed to the feature call:
HTTP404: NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier).
(XHR)GET - http://localhost:49862/jspm_packages/github/urosg80/aurelia-chart@0.2.5.js
Sorry, didn't mean to close this
@pierslawson I had the same issues but if I add the following lines to config.js it seems to work fine.:
packages: { "aurelia-chart": { "main": "index.js" } },
.
We do that on the example to fudge JSPM to load the module locally, but you should not need to do that normally, ultimately its a JSPM related issue, if someone can show me or do a PR with the desired JSPM config that will load it all correctly I will get it added.
can someone please try install from my npm package: "jspm install npm:aurelia-ugchart" (https://www.npmjs.com/package/aurelia-ugchart) it's the 0.2.5 version prepared for my previous PR as it seems to me that JSPM is quite picky for installation depending on source (npm, git, ...)
didnt @pierslawson try your branch and got the same issue?
yes, but from github and this is why I suspect that JSPM is handling installation differently depending on source and would just like to double check as it worked for me when installing from npm and why I then submitted the PR
@urosg80 I've installed your package and didn't get any install warnings... however the package has not actually been installed in the JSPM directory... I'll try again. This was the information spat out by JSPM as I installed
jspm install npm:aurelia-ugchart
Looking up npm:aurelia-ugchart
Updating registry cache...
Downloading npm:aurelia-ugchart@0.2.10
Looking up npm:aurelia-framework
Looking up npm:chart.js
Looking up npm:chartjs-color
Looking up npm:moment
Looking up npm:aurelia-binding
Looking up npm:aurelia-dependency-injection
Looking up npm:aurelia-loader
Looking up npm:aurelia-logging
Looking up npm:aurelia-metadata
Looking up npm:aurelia-pal
Looking up npm:aurelia-path
Looking up npm:aurelia-task-queue
Looking up npm:aurelia-templating
Looking up npm:color-convert
Looking up npm:chartjs-color-string
Looking up npm:color-name
Looking up github:jspm/nodelibs-child_process
Looking up github:jspm/nodelibs-buffer
Looking up github:systemjs/plugin-json
Looking up github:jspm/nodelibs-process
Looking up npm:buffer
Looking up npm:base64-js
Looking up npm:ieee754
Looking up npm:isarray
Looking up github:jspm/nodelibs-fs
Looking up npm:process
Looking up github:jspm/nodelibs-vm
Looking up github:jspm/nodelibs-assert
Looking up npm:vm-browserify
Looking up npm:assert
Looking up npm:indexof
Looking up npm:util
Looking up npm:inherits
Looking up github:jspm/nodelibs-util
ok Installed aurelia-ugchart as npm:aurelia-ugchart@^0.2.10 (0.2.10)
ok Install tree has no forks.
ok Install complete.
lol the plot thickens
OK... I tried to uninstall and was given the message:
warn Dependency npm:aurelia-ugchart is not an existing primary install.
So I manually deleted it from package.json and config.js. I installed again and the sub-directory was created and the aurelia-ugchart@0.2.10.js
was put into the correct directory. I changed from use.feature() to .use.plugin() and it worked!
@grofit as you can see the PR I prepared before works and as I suspected JPSM handles installation from different sources differently i.e. source from npm installs but from github not although the actual files are the same... "interesting" ;)
just to confirm when you use the official npm repo for this npm:aurelia-chart
do you get the same issue? cannot remember if you were installing via github or npm by default?
If it is down to the way JSPM handles this I think its something to be discussed with JSPM guys but I dont really have capacity to chase those guys down again, so if anyone else is in that domain and fancies picking it up with them go for it.
Around a month ago I was able to resolve this issue by installing from master instead of the regular release. However, since you have made the change to "fix" this problem for release, I have no longer been able to use this work-around. The latest release does not resolve the issue either.
I am still having this issue as well.
I've tried installing the package in the following ways: jspm install aurelia-chart jspm install npm:aurelia-chart jspm install github:grofit/aurelia-chart jspm install github:grofit/aurelia-chart@master jspm install github:urosg80/aurelia-chart
Regardless of my installation method, there is never an "aurelia-chart.js" inside of the package directory, as there should be, and I receive the aforementioned "404 not found" error upon loading my aurelia app.
EDIT: As noted below, "jspm install npm:aurelia-ugchart" works fine.
@JesseNewman19 please try also and report: jspm install npm:aurelia-ugchart
@urosg80 That one worked for me, thanks.
by all means @urosg80 do another PR with the current version to make it work (making sure the demos still work too).
I couldn't get this to work in my app (the same 404 as above) so I setup a fresh app via the skeleton-esnext (1.1.1), ran:
jspm install npm:aurelia-ugchart
added:
use .plugin("aurelia-ugchart");
and the added aura-ugchart to bundles.js
"dist/aurelia": {
"includes": [
"aurelia-framework",
...
"aurelia-ugchart",
"[aurelia-ugchart/**/*.js]",
"[aurelia-ugchart/**/*.html]"
and that all seems ok when run locally with gulp watch.
If I use gulp export and then run it on my remote server I get 404:
GET http://www.[].com/jspm_packages/npm/chart.js@2.4.0.js 404 (Not Found) Unhandled rejection (SystemJS) XHR error (404 Not Found) loading http://www.[].com/jspm_packages/npm/chart.js@2.4.0.js
I confess I'm new to JSPM and gulp - so feel free to point out any blindingly obvious omissions I've made....
Thanks
Do we have a status on this working w/JSPM?
current status is:
If someone with more knowledge of JSPM than I can fix this and do a PR it will be solved, I am not actively looking into it as its been fixed multiple times then breaks again for some reason, so I am not sinking any more time into it.
aurelia-chart version: 0.2.7
The following worked for me:
inside config.js
, add to System.config:
packages: { "aurelia-chart": { "main": "index.js" } },
inside bundles.js
, add to dist/aurelia: includes:
"aurelia-chart", "[aurelia-chart/**/*.js]", "aurelia-chart/**/*.html!text",
config.js
and bundles.js
are auto generated though right? so is there a way to get it to generate those files with those criteria if that works for everyone?
Although this should be fixed, @grofit, config.js
can be edited manually and respects your mappings and bundles.js
AFAIK is completely custom.
@JoshMcCullough Yes, bundles.js is the file used to configure the output, e.g when doing a gulp export. I think only the config.js part needs to be fixed. For other plugins, just referencing the plugin name in bundles.js knows about its own main js file. Maybe renaming index.js to aurelia-chart.js might fix the issue
Sorry if I am a bit simple here but where is this bundles.js
file? as I only see the config one or the automatically output bundle.js one which I think is for the example only. Is this in a new version of jspm or something?
@grofit from aurelia-skeleton : https://github.com/aurelia/skeleton-navigation/blob/master/skeleton-typescript/build/bundles.js
I don't know if this is something you can add. It should rather be part of your ReadMe/Documention
That bundles.js
is used by the Aurelia bundle builder, which this project doesn't use as it was created before that existed. I am not even sure if that is a supported way of doing things now that they have the new aurelia cli for stuff
I believe this is the solution: https://jspm.io/0.17-beta-guide/overrides.html https://github.com/jspm/registry/issues/516
jspm install npm:aurelia-chart -o "{main: 'index.js'}"
I have installed Aurelia-chart using your JSPM instructions and it has turned up in my package.json and config.js files OK. The files are also present in a aurelia-chart@0.2.5 directory under my jspm_packages/npm directory. However, for other packages I see a corresponding js file in the jspm_packages/npm directory, but there isn't a aurelia-chart@0.2.5.js file created. So when my application runs I get a 404 as the browser tries to load jspm_packages/npm/aurelia-chart@0.2.5.js
I wondering if I have missed a step?