I'm entering a project where npm produces an issue for a long time, and none have the knowledge of when and why it appeared. I would like to have some clues on where (or what) to search.
a simple mvn clean install
performs an npm install
after having installed the npm plugin.
I can see that his work involves the creation (or the presence) of a link that will makes a directory
target/node/node_modules/uglify-js
targeting ~/front-end/uglify-js/
this last one appearing to be a source folder (?) of our project, or something needed by npm
(I don't know uglify myself). As I can see:
find ~/front-end/target/node/node_modules -type l -ls
3096224744204072 0 lrwxrwxrwx 1 me 1049089 101 Oct 18 09:20 /c/Users/front-end/target/node/node_modules/uglify-js -> /c/Users/front-end/uglify-js/
That folder ~/front-end/uglify-js/
is initially carrying files package.json
, index.js
and link-package.js
But when npm install
takes place, it fails on an addLocal
internal step.
[INFO] --- frontend-maven-plugin:1.3:npm (npm install) @ front-end ---
[DEBUG] Configuring mojo com.github.eirslett:frontend-maven-plugin:1.3:npm from plugin realm ClassRealm[plugin>com.github.eirslett:frontend-maven-plugin:1.3, parent: sun.misc.Launcher$AppClassLoader@4e25154f]
[DEBUG] Configuring mojo 'com.github.eirslett:frontend-maven-plugin:1.3:npm' with basic configurator -->
[DEBUG] (f) arguments = install
[DEBUG] (f) installDirectory = C:\Users\front-end\target
[DEBUG] (f) npmInheritsProxyConfigFromMaven = true
[DEBUG] (f) project = MavenProject: com.front-end:front-end:10.7.14-xxx_yyyyy @ C:\Users\front-end\pom.xml
[DEBUG] (f) repositorySystemSession = org.eclipse.aether.DefaultRepositorySystemSession@585c13de
[DEBUG] (f) session = org.apache.maven.execution.MavenSession@187eb9a8
[DEBUG] (f) skip = false
[DEBUG] (f) skipTests = false
[DEBUG] (f) workingDirectory = C:\Users\front-end
[DEBUG] (f) execution = com.github.eirslett:frontend-maven-plugin:1.3:npm {execution: npm install}
[DEBUG] -- end configuration --
[INFO] Running 'npm install' in C:\Users\front-end
[ERROR] npm ERR! addLocal Could not install C:\Users\front-end\uglify-js
[ERROR] npm ERR! Windows_NT 10.0.18363
[ERROR] npm ERR! argv "C:\\Users\\front-end\\target\\node\\node.exe" "C:\\Users\\front-end\\target\\node\\node_modules\\npm\\bin\\npm-cli.js" "install"
[ERROR] npm ERR! node v10.24.1
[ERROR] npm ERR! npm v2.15.12
[ERROR] npm ERR! code EISDIR
[ERROR] npm ERR! errno -4068
[ERROR] npm ERR! syscall read
[ERROR]
[ERROR] npm ERR! eisdir EISDIR: illegal operation on a directory, read
[ERROR] npm ERR! eisdir This is most likely not a problem with npm itself
[ERROR] npm ERR! eisdir and is related to npm not being able to find a package.json in
[ERROR] npm ERR! eisdir a package you are trying to install.
What I can see after this failure happens, it's that there is an existing folder ~/front-end/uglify-js/
on my disk, but that it is now empty : it has been recreated.
And the npm-debug.log
gives no other information than the one upper.
If I restore the missing files (package.json
, index.js
, link-package.js
) in that directory and retry mvn clean install
this problem won't reproduce.
As if it was occurring only one time per day? Humm... Unsure...
Our node and npm version are : node v10.24.1
and npm v2.15.12
.
We eventually found that it's a Maven issue that is the cause of our trouble.
It doesn't honor it's <followSymLinks>false</followSymLinks>
settings and follows it whatever, and during the removal of a link file in target
directory, npm
causes (by Maven) the deletion of the file source of the link.