srs / gradle-node-plugin

Gradle plugin for integrating NodeJS in your build. :rocket:
Apache License 2.0
867 stars 210 forks source link

Operation not permitted on NpmTask #337

Open qbixsd opened 5 years ago

qbixsd commented 5 years ago

When I tried to run my subproject it always fails, whatever version of node/npm I try to use. The message is:

> react-scripts build

Failed to compile.

EPERM: operation not permitted, unlink '{project_dir}\frontend\build\node\node-v10.16.0-win-x64\node.exe'

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! frontend@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the frontend@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

The build script for subproject is:

plugins {
    id "com.moowork.node" version "1.3.1"
}

version '0.0.1'

node {
    version = '10.16.0'
    npmVersion = '6.9.0'
    download = true
    workDir = file("${project.buildDir}/node")
    nodeModulesDir = file("${project.projectDir}")
}

task build(type: NpmTask) {
    inputs.dir("src")
    outputs.dir("dist")
    args = ['run-script', 'build']
}

build.dependsOn(npm_install)

I've tried npm run-script build with locally installed nodejs and npm, as well as starting project on ubuntu virtual box, both manually and through my gradle frontend:build task, and it went well. The only place, where I do have problems is windows using gradle (either through intelliJ, using jdk12, as well, as jdk8 from command line).