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

npmInstall task fails if the nodeModulesDir doesn't exist #108

Closed
MHarris021 opened this issue Apr 19, 2016 · 1 comment
Closed

npmInstall task fails if the nodeModulesDir doesn't exist #108

MHarris021 opened this issue Apr 19, 2016 · 1 comment
Labels

Comments

@MHarris021
Copy link

When running the npmInstall task, if the nodeModulesDir doesn't exist the task will fail.
Adding this code:
`
task createNodeModulesDir << {
if (!nodeModulesDir.isDirectory()) {
nodeModulesDir.mkdirs()
}
}

npmInstall.dependsOn createNodeModulesDir
`

fixes the problem, but it would be nice not to have to do this.

This will break initial builds if the nodeModulesDir is included in the .gitignore file

@raulgd
Copy link

raulgd commented May 19, 2016

I'm having the same issue... but instead of adding the createNodeModulesDir task, I'm adding it inside the node {} section, so mine looks like this:

node {
    version = '6.2.0'
    npmVersion = '3.9.0'
    distBaseUrl = 'https://nodejs.org/dist'
    download = true
    workDir = file("${project.projectDir}/nodejs")
    nodeModulesDir = file("${project.projectDir}/node_modules")
    if (!nodeModulesDir.isDirectory()) {
        nodeModulesDir.mkdirs()
    }
}

Your workaround is great, but I think it's a bit cleaner on the node section.

Of course, I hope this is fixed soon, and just add the folder creation on the plugin code instead.

@srs srs added the bug label Jun 21, 2016
@srs srs closed this as completed in 39d8a9e Jun 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants