Jenkins (in a Docker container) - npm install fails because of ... npm WARN tar ENOENT: no such file or directory, futime
After talking to a number of experts and reading a lot of forum posts, the following is the proposed 'workaround'. Many people use the workaround. I hope you have a better solution than this one. At least, this workaround works.
Following the workaround, building Angular in Maven can go like this: first clear the workspace, especially removing the node_modules folder and the package-lock.json file. Then start the npm install and the build action.
If you are in a hurry after creating your first build, just add a property 'maven.exec.skip', and start Maven with the -P maven.exec.skip=true. Then the cleaning and npm install step are skipped ;-)
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.6.0</version> <executions> <execution> <id>npm clear workspace</id> <goals> <goal>exec</goal> </goals> <phase>initialize</phase> <configuration> <skip>${maven.exec.skip}</skip> <executable>rm</executable> <arguments> <argument>-rf</argument> <argument>node_modules</argument> <argument>package-lock.json</argument> </arguments> </configuration> </execution> <execution> <id>npm install</id> <goals> <goal>exec</goal> </goals> <phase>initialize</phase> <configuration> <skip>${maven.exec.skip}</skip> <executable>npm</executable> <arguments> <argument>install</argument> </arguments> </configuration> </execution> <execution> <id>build Angular production code</id> <goals> <goal>exec</goal> </goals> <phase>generate-resources</phase> <configuration> <executable>npm</executable> <arguments> <argument>run</argument> <argument>build</argument> <!--<argument>--prod</argument>--> </arguments> </configuration> </execution> </executions> </plugin>