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

fix(dependencies) add gulp and typescript to the dependencies #803

Closed

Conversation

heikomat
Copy link

the aurelia-cli cannot be used in its entirety without having gulp@^4.0.0 and typescript installed. The aurelia-cli depends on them at least at these places during au build:

gulp (fails with Error: Cannot find module 'gulp')

const gulp = require('gulp');

gulp@^4.0.0 (fails with TypeError: Cannot read property 'apply' of undefined)

return original.apply(gulp, args);

typescript (fails with Error: Cannot find module 'typescript')

let ts = require('typescript');

The dependencies of the package.json should reflect, that the aurelia-cli requires these dependencies to be used. This is what is implemented in this branch.

This fixes #801

@CLAassistant
Copy link

CLAassistant commented Jan 19, 2018

CLA assistant check
All committers have signed the CLA.

@AshleyGrant
Copy link
Contributor

@JeroenVinke any chance we can get this merged?

@JeroenVinke
Copy link
Collaborator

I'd like to discuss this a bit. I might be overlooking something, but without having typescript and gulp installed (globally) I can run a new typescript app. Gulp and typescript are getting installed locally which seems to be enough.

That said, I have seen those errors before (TypeError: Cannot read property 'apply' of undefined and it not being able to find any module). I never really looked into it further because for me it only occurred when I npm link'd the aurelia cli, which is not something that you would do as a user. These errors are actually the reason for steps 5 and 6 in the readme here.

Could you explain the specifics of the post install task that you're using? Perhaps we can get to the root cause of this

@heikomat
Copy link
Author

heikomat commented Feb 4, 2018

@JeroenVinke I can.

TL;DR: I don't install the aurelia-cli to the aurelia-project, but instead install it in a folder further up, and then link it to the node_modules of the aurelia-project, therefore making the aurelia-cli unable to find the correct gulp-version, because it is not installed alongside the aurelia-cli, because it is not listed in its dependencies.

Detailed version:
The specific use case i have is as follows:

We have a modular project that consists of about 70 repositories. To manage all of them we have one repository that uses meta and minstall to clone, install, link and build all these 70 repositories so that a developer can change something in one of these locally cloned folders and have the change take effect in our application.

This meta-repository is (in other words) the developer-setup for our modular application.

One of these 70 repositories is an aurelia-application, which is the only one that can't be built after the dependency-installation through minstall. The reason for that is, that in order to save (a lot) of time, minstall hoists the dependencies as far up as possible without creating conflicts. It also installes every dependency only once per conflicting version. The result is, that every dependency of every of these 70 modules is installed at least once somewhere: Either in the meta-repo-folder itself, or in one of the module-folders.

After the installation phase, minstall checks what dependencies are installed where, and what dependencies are required where, and links them accordingly. The result is, that every one of these modules has at the very least a node_modules folder, where all its dependecies are linked into.

What happens now with the aurelia-project is, that the aurelia-cli is not installed to the node_modules-folder of the aurelia-project, but to the node_modules of the meta-repo-folder, and then linked from there to the aurelia-project-node_modules. Because of that, the npm-commands in our package.json here see an aurelia-cli in their local node_modules, use that, but because that aurelia-cli is actually in a different folder, that aurelia-cli is not using the gulp-version of our aurelia-project, but some other gulp-version that just happened to be installed to the meta-repo-node_modules.

If the aurelia-cli would explicitly state that it requires these dependencies to work, then installing it to a different folder and then linking it wouldn't be a problem, because the npm install aurelia-cli-command would make sure, that some correct version of gulp and typescript are installed along with the aurelia-cli

@JeroenVinke
Copy link
Collaborator

Thank you for the detailed description. I'll need to give this some thought

JeroenVinke added a commit to JeroenVinke/cli that referenced this pull request Mar 26, 2018
@JeroenVinke
Copy link
Collaborator

let's do it. I've opened #857 which has a couple of additional changes

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

Successfully merging this pull request may close these issues.

gulp is a devDependency, when it should be a regular or peerDependency
6 participants