jspm / registry

The jspm registry and package.json override service
https://jspm.io
229 stars 256 forks source link

Difference between Jenkins and local build #1042

Closed PizzaPete closed 5 years ago

PizzaPete commented 7 years ago

Hello,

We are using Jenkins to build our files for production. Whenever we run: jspm install it downloads the dependencies on our Jenkins machine but the files it installs are different from the files being downloaded when we run the command locally.

The thing is that JSPM packages on our local development machines start with: /* */ "format global"; "exports angular"; While these lines aren't added on the files that Jenkins installs.

Whenever we run the jspm bundle command on these files we also get a difference.

Local files start with: System.registerDynamic("npm:angular@1.5.8/angular.js", [], false, function ($__require, $__exports, $__module) {

While files on Jenkins start with: System.registerDynamic('npm:angular@1.5.8/angular.js', [], true, function ($__require, exports, module) {

We've tried a lot of different things:

But somehow we can't get it to work. Do you have any idea how to fix this? It this something at our Jenkins server side? Or did we forget a step?

aluanhaddad commented 7 years ago

I am not familiar with Jenkins but it sounds like you have different versions of jspm involved. One is likely installed globally. This is not problem so long as you always run against the same local version on your CI server and your local dev environment. For example if your logical build script looks like

Your logical build script (again I am not familiar with Jenkins) looks like

> cd "directory containing package.json"

> npm install

> jspm install

> jspm bundle app

print the version between each command

> cd "directory containing package.json"

> jspm --version
0.17.0-beta.40 #just an example version
Running against global jspm install.

> npm install

> jspm --version
0.16.52 #just an example version
Running against local jspm install.

> jspm install

> jspm bundle app

If you are running against a global install after npm install has completed, then npm is not installing jspm locally.

Always use a local installation of jspm specified in your package.json.

Test this locally with a fresh install by running rm -rf node_modules

If there is a fully populated node_modules already present due to a previous build, then you will see a different result for the initial jspm --version which is fine.

PizzaPete commented 7 years ago

Hey @aluanhaddad,

Thank you for your reply. I've checked out the version we are using locally and on our Jenkins server. The version is the same, jspm -v returns in both cases:

0.16.52 Running against local jspm install.

Still the issue persists.

If i'm checking the output of the console on Jenkins there are less files being installed.

I'm missing some files like:

And a whole lot more... could this be the problem?

aluanhaddad commented 7 years ago

Try fully removing the node_modules directory and running

> jspm cache-clear

> npm install --force

> jspm install

in both local and CI environments

PizzaPete commented 7 years ago

I've tested it with the commands you provided but I still get the same result.

I have no idea why some JSPM files aren't being installed on the Jenkins build server but are being installed locally.

PizzaPete commented 7 years ago

I've checked the .dependencies.json file within the 'jspm_packages' directory and this is different from the local file. It seems like some JSPM files where JSPM depends on are not being installed correctly.

aluanhaddad commented 7 years ago

Interesting, I wonder if this is the result of updating from an older version. I assume this issue only crops up on Jenkins and that it works fine for you across multiple development environments. If you could share any information that could be used as a repro it would be appreciated. As I said earlier I'm not experienced with Jenkins. @guybedford any thoughts on this?

PizzaPete commented 7 years ago

@aluanhaddad thank you for your response again. I've created a basic repo with our pom, package.json and jspm.config.js in it. We're missing the build step from gulp and webpack in here but this will give you an insight what we are trying to install and what commands we use.

I hope this helps in getting to know what breaks our build.