aurelia-chart icon indicating copy to clipboard operation
aurelia-chart copied to clipboard

JSPM Install Does not create js file to import

Open pierslawson opened this issue 8 years ago • 43 comments

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 [email protected] 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 [email protected] file created. So when my application runs I get a 404 as the browser tries to load jspm_packages/npm/[email protected]

I wondering if I have missed a step?

pierslawson avatar Nov 01 '16 19:11 pierslawson

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

pierslawson avatar Nov 01 '16 20:11 pierslawson

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 :( )

grofit avatar Nov 01 '16 20:11 grofit

No, aurelia-chart.js hasn't turned up in the dist directory. The loader tries to load jspm_packages/npm/[email protected] but that doesn't exist either. I've got JSPM 0.16.47 running.

pierslawson avatar Nov 02 '16 15:11 pierslawson

Can you screenprint or tell me what is in your JSPM folder for the aurelia-chart module?

grofit avatar Nov 02 '16 15:11 grofit

-wwwroot
  |- jspm_packages
           |- npm
                |- [email protected]
                     |- .jspm-hash
                     |- index.js
                     |- attributes
                     |      |- chart-attribute.js
                     | 
                     |- elements
                     |      |- chart-element.html
                     |      |- chart-element.js
                     | 
                     |- observers
                            |- model-observer.js

pierslawson avatar Nov 02 '16 15:11 pierslawson

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 avatar Nov 03 '16 08:11 grofit

@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.

urosg80 avatar Nov 03 '16 10:11 urosg80

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.

grofit avatar Nov 03 '16 10:11 grofit

I think this issue could be linked as duplicate #15

urosg80 avatar Nov 03 '16 10:11 urosg80

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.

grofit avatar Nov 03 '16 10:11 grofit

I'm afraid that didn't fix it. I still get a 404 as the browser tries to load jspm_packages/npm/[email protected]

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:[email protected]
     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:[email protected].
     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:[email protected]
     Removing package files for npm:[email protected]
ok   Install tree has no forks.

ok   Install complete.

pierslawson avatar Nov 03 '16 16:11 pierslawson

@pierslawson can you try to install from my repo just for test: "jspm install github:urosg80/aurelia-chart" as this was working before.

urosg80 avatar Nov 04 '16 13:11 urosg80

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.

grofit avatar Nov 04 '16 13:11 grofit

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.

urosg80 avatar Nov 04 '16 13:11 urosg80

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.

grofit avatar Nov 04 '16 13:11 grofit

@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/[email protected]

pierslawson avatar Nov 08 '16 10:11 pierslawson

Sorry, didn't mean to close this

pierslawson avatar Nov 08 '16 16:11 pierslawson

@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" } },.

Keethanjan avatar Nov 10 '16 07:11 Keethanjan

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.

grofit avatar Nov 10 '16 08:11 grofit

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, ...)

urosg80 avatar Nov 10 '16 09:11 urosg80

didnt @pierslawson try your branch and got the same issue?

grofit avatar Nov 10 '16 09:11 grofit

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 avatar Nov 10 '16 09:11 urosg80

@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:[email protected]
     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.

pierslawson avatar Nov 16 '16 13:11 pierslawson

lol the plot thickens

grofit avatar Nov 16 '16 13:11 grofit

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 [email protected] was put into the correct directory. I changed from use.feature() to .use.plugin() and it worked!

pierslawson avatar Nov 16 '16 14:11 pierslawson

@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" ;)

urosg80 avatar Nov 23 '16 14:11 urosg80

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.

grofit avatar Nov 23 '16 15:11 grofit

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.

ghost avatar Nov 29 '16 18:11 ghost

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 avatar Nov 29 '16 19:11 JesseNewman19

@JesseNewman19 please try also and report: jspm install npm:aurelia-ugchart

urosg80 avatar Nov 29 '16 20:11 urosg80