1

We have some react projects that are built with maven because reasons.
Point is, we used to run a maven plug-in with npm install, and everything was fine with the world.

Lately we decided to improve our building process and use npm ci so all the versions would be fixed.

Since then, every time the project is built, we can see the following error:

[INFO] > fsevents@1.2.11 install /home/username/applications/react/magnificent-app-name/src/main/frontend/node_modules/fsevents
[INFO] > node-gyp rebuild
[INFO] 
[INFO] internal/modules/cjs/loader.js:584
[INFO]     throw err;
[INFO]     ^
[INFO] 
[INFO] Error: Cannot find module 'graceful-fs'
[INFO]     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
  • If we run manually npm install in the project folder, no errors.
  • If we run manually npm ci in the project folder, no errors.
  • If we run npm install through the maven plug-in, no errors.
  • If we run npm ci through the maven plug-in, the above error appears.

We also tried npm ci --no-optionals after reading some related github issues, but it didn't change anything.

We reinstalled npm.
We cleared the cache.
We did pretty much anything the internet said.
Still, Cannot find module 'graceful-fs'.

the maven plug-in definition, just in case:

<build>
    <plugins>
       <plugin>
          <groupId>com.github.eirslett</groupId>
          <artifactId>frontend-maven-plugin</artifactId>
          <executions>
             <execution>
                <id>install node and npm</id>
                <goals>
                   <goal>install-node-and-npm</goal>
                </goals>
                <phase>generate-resources</phase>
             </execution>
             <execution>
                <id>npm install</id>
                <goals>
                   <goal>npm</goal>
                </goals>
                <configuration>
                   <arguments>ci --no-optionals</arguments>
                </configuration>
             </execution>
             <execution>
                <id>npm build</id>
                <goals>
                   <goal>npm</goal>
                </goals>
                <configuration>
                   <arguments>run build -- --env.conf ${build.profile.id} --env.mvn</arguments>
                </configuration>
             </execution>
          </executions>
          <configuration>
             <nodeVersion>${node.lts.version}</nodeVersion>
             <installDirectory>../node_installation</installDirectory>
             <workingDirectory>src/main/frontend</workingDirectory>
          </configuration>
       </plugin>
    </plugins>
 </build>

We're using node 10.15.3.

Any ideas?

Leo Lozes
  • 1,358
  • 1
  • 15
  • 33

0 Answers0