Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

NPM run tasks with pre and/or post do not properly run #146

Closed
gkohen opened this issue Oct 14, 2016 · 4 comments · Fixed by #179
Closed

NPM run tasks with pre and/or post do not properly run #146

gkohen opened this issue Oct 14, 2016 · 4 comments · Fixed by #179
Milestone

Comments

@gkohen
Copy link

gkohen commented Oct 14, 2016

Hi,

As we started to use more NPM scripts with version 2.12, we've noticed some issues for this task:

task e2eTestWebApp(type: NpmTask) {
    outputs.upToDateWhen { false };
    args = ['run', 'e2e']
}

In package.json we have the following scripts:

    "e2e": "npm run protractor",
    "pree2e": "npm run webdriver:update -- --standalone"

When running npm run e2e from command line, it properly. That is it runs pree2e script and then the e2e one.
When doing the same through the Gradle task above, it shows on the console the following commands:

npm run protractor
npm run webdriver:update -- --standalone

But the commands do not actually execute (no-op for both). I wonder if the blame is on the the way the gradle plugin runs NPM with npm_cli.js

Considering NPM scripts is becoming a prominent way of building web apps, it would be good if we can have some more tests/support to NPM run.

Thanks for a great plugin, by the way.

@maxlegault
Copy link

+1

@stevies
Copy link

stevies commented Nov 3, 2016

It rather defeats some of the purpose of this plugin, but you can do something like:

task e2eTestWebApp(type: Exec) {
    workingDir = file("${project.projectDir}/whatever")
    executable = 'npm'
    args = ['run-script', 'e2e'']
}

Essentially, use the plugin to install node and run the npm install, then just run the usual npm scripts with npm as a normal executable.

@dartiga
Copy link

dartiga commented Nov 9, 2016

We were able to make it work by using a local 'npm' installation. In our case:

node {
    version = '5.11.0'
    npmVersion = '3.8.6'
    download = true
}

@s0x
Copy link
Contributor

s0x commented Dec 1, 2016

I could not solve it by just using the above configuration. Though I spotted the reason of this issue described in #164

@srs srs added node and removed node labels Dec 4, 2016
s0x added a commit to s0x/gradle-node-plugin that referenced this issue Dec 19, 2016
This closes srs#164, closes srs#149, closes srs#146 and closes srs#134
@srs srs closed this as completed in #179 Jan 13, 2017
@srs srs added this to the 1.1.0 milestone Jan 13, 2017
hjeong11 pushed a commit to tacitknowledge/gradle-grails-sass that referenced this issue Jul 6, 2017
hjeong11 pushed a commit to tacitknowledge/gradle-grails-jspm that referenced this issue Jul 6, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants