Thursday, 25 May 2017

Running maven plugin as administrator

I have the following plugin in my pom:

<plugin>
    <groupId>com.github.eirslett</groupId>
    <artifactId>frontend-maven-plugin</artifactId>
    <version>1.0</version>
    <executions>
        <execution>
            <id>install node and npm</id>
            <goals>
                <goal>install-node-and-npm</goal>
            </goals>
            <configuration>
                <nodeVersion>${node.version}</nodeVersion>
                <npmVersion>${npm.version}</npmVersion>
            </configuration>
        </execution>
        <execution>
            <id>ng command install</id>
            <goals>
                <goal>npm</goal>
            </goals>
            <configuration>
                <arguments>install -g @angular/cli</arguments>
            </configuration>
        </execution>
        <execution>
            <id>npm install</id>
            <goals>
                <goal>npm</goal>
            </goals>
            <configuration>
                <arguments>install</arguments>
            </configuration>
        </execution>
    </executions>
</plugin>

The objective of it is to not upload the node_modules folder to the repository and make it work the the CI deploys the app.

Everything works on my machine with windows and in the CI, but when I run "sudo mvn clean install" on Ubuntu it says this:

"[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.0:npm (ng command install) on project Project: Failed to run task: 'npm install -g @angular/cli' failed. java.io.IOException: Cannot run program "/src/main/resources/tmp/node/node" (in directory "/src/main/resources/webapp"): error=13, Permission denied -> [Help 1]"

If I remove it, it says the same with the npm install, I think that it might be permissions problem, but I run "sudo chmod 777 -R /project" and it still not working.

Does anyone know how can I solve this? I can't run it on Ubuntu and is very strange because ubuntu is good for programming.



via Motomine

No comments:

Post a Comment