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:
- rm -rf node_modules
- rm -f package-lock.json
- npm install
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.