When running 'npm install' in a Jenkins Docker container I get these errors:
[INFO] --- exec-maven-plugin:1.6.0:exec (npm install) @ geosolutions --- npm WARN tar ENOENT: no such file or directory, open '/var/jenkins_home/workspace/aproject2/node_modules/.staging/schema-utils-bdceae78/package.json' npm WARN tar ENOENT: no such file or directory, open '/var/jenkins_home/workspace/aproject2/node_modules/.staging/schema-utils-bdceae78/README.md' ...(and many lines like) ... npm WARN tar ENOENT: no such file or directory, futime npm WARN tar ENOENT: no such file or directory, futime npm WARN tar ENOENT: no such file or directory, futime npm WARN tar ENOENT: no such file or directory, futime
No 'node_modules' are generated. Only a few in node_modules/.staging.
When going into the Jenkins Docker container, I can fix this by manually performing:
The next time I have to skip the 'npm install' step, so directly start with the 'ng build'. Then everything works OK. Of couse - this is not a decent workaround. Therefore this is NOT a duplicate question.
How can I do a good 'npm install'?
In my Jenkins container I have a Node/Npm installation. Npm is 6.5 and node is either 8, 9, 10 or 11. All with the newest npm 6.5.
My Jenkins image contains this code for adding npm/nodejs to it:
RUN apt-get install -y curl \
&& curl -sL https://deb.nodesource.com/setup_9.x | bash - \
&& apt-get install -y nodejs \
&& curl -L https://www.npmjs.com/install.sh | sh
Update: Today I had the same issue at the office. Two different Jenkinsjobs start the very same Maven task with 'npm install'. One is OK, the other not. One Jenkinsjob is started via a multibranch, the other as a regular pipeline. Hmm, very strange.
I think this has to do with the operating environment, so the $PATH, environment variables, etc.
To resolve the ENOENT warning message, you need to add a package. json file in the directory where you run the npm install command. And then run your npm install command again. This time, the warning message should not appear.
Broken npm installation If your npm is broken: On Mac or Linux, reinstall npm. Windows: If you're on Windows and you have a broken installation, the easiest thing to do is to reinstall node from the official installer (see this note about installing the latest stable version).
While doing npm install, inside node_modules . staging folder is getting created. Reasons: This is a temporary folder where the modules will be kept untill npm downloads all the modules specified in the package.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With