Build error on Bamboo server.

Hi,

I am trying to build a Vaadin 14 application on a bamboo server running on Centos 7.

I am getting the following error and I am not sure what to do to fix it. This builds fine on my workstation.

This is the last few lines for the npm debug log.

25620 warn notsup Unsupported engine for watchpack-chokidar2@2.0.0: wanted: {"node":"<8.10.0"} (current: {"node":"12.18.3","npm":"6.14.6"})
25621 warn notsup Not compatible with your version of node/npm: watchpack-chokidar2@2.0.0
25622 verbose notsup Not compatible with your version of node/npm: watchpack-chokidar2@2.0.0
25622 verbose notsup Required: {"node":"<8.10.0"}
25622 verbose notsup Actual:   {"npm":"6.14.6","node":"12.18.3"}
25623 warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/chokidar/node_modules/fsevents):
25624 warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
25625 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS:    darwin
25625 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch:  any
25625 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS:   linux
25625 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
25626 warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/watchpack-chokidar2/node_modules/chokidar/node_modules/fsevents):
25627 warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
25628 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS:    darwin
25628 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch:  any
25628 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS:   linux
25628 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
25629 warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/@babel/cli/node_modules/chokidar/node_modules/fsevents):
25630 warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
25631 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS:    darwin
25631 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch:  any
25631 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS:   linux
25631 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
25632 warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/webpack-dev-server/node_modules/chokidar/node_modules/fsevents):
25633 warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
25634 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS:    darwin
25634 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch:  any
25634 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS:   linux
25634 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
25635 warn no-name@ No description
25636 warn no-name@ No repository field.
25637 verbose stack Error: @vaadin/vaadin-usage-statistics@2.1.0 postinstall: `node check.js`
25637 verbose stack Exit status 1
25637 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
25637 verbose stack     at EventEmitter.emit (events.js:315:20)
25637 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
25637 verbose stack     at ChildProcess.emit (events.js:315:20)
25637 verbose stack     at maybeClose (internal/child_process.js:1021:16)
25637 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
25638 verbose pkgid @vaadin/vaadin-usage-statistics@2.1.0
25639 verbose cwd /var/atlassian/application-data/bamboo/xml-data/build-dir_12/SOSBC-AWA-JOB1
25640 verbose Linux 3.10.0-1062.7.1.el7.x86_64
25641 verbose argv "/usr/bin/node" "/bin/npm" "--no-update-notifier" "--no-audit" "install"
25642 verbose node v12.18.3
25643 verbose npm  v6.14.6
25644 error code ELIFECYCLE
25645 error errno 1
25646 error @vaadin/vaadin-usage-statistics@2.1.0 postinstall: `node check.js`
25646 error Exit status 1
25647 error Failed at the @vaadin/vaadin-usage-statistics@2.1.0 postinstall script.

Hi,

I am still stuck with this … any help appreciated.

If I check out the project from Git into the build environment and run

mvn package -Pproduction 

I get the following…

[root@bamboov7 DCU-WPP-JOB1]
# mvn package -Pproduction
[INFO]
 Scanning for projects...
[INFO]

[INFO]
 --------------------------------[ war ]
---------------------------------
[INFO]

[INFO]
 Copying 2 resources
[INFO]

[INFO]
 --- maven-compiler-plugin:3.8.0:compile (default-compile) @  ---
[INFO]
 Changes detected - recompiling the module!
[INFO]
 Compiling 11 source files to /var/atlassian/application-data/bamboo/xml-data/build-dir_12/DCU-WPP-JOB1/target/classes
[INFO]

[INFO]
 --- vaadin-maven-plugin:14.2.0:prepare-frontend (default) @  ---
[INFO]

[INFO]
 --- vaadin-maven-plugin:14.2.0:build-frontend (default) @ prject ---
[INFO]
 Scanning classes to find frontend configurations and dependencies...
[INFO]
 Visited 1480 classes. Took 2032 ms.
[INFO]
 Visited 100 classes. Took 111 ms.
[INFO]
 Running `npm install` to resolve and optionally download frontend dependencies. This may take a moment, please stand by...
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
internal/modules/cjs/loader.js:968
  throw err;
  ^

Error: Cannot find module '/var/atlassian/application-data/bamboo/xml-data/build-dir_12/DCU-WPP-JOB1/node_modules/@vaadin/vaadin-core-shrinkwrap/node_modules/@vaadin/vaadin-usage-statistics/check.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    at Function.Module._load (internal/modules/cjs/loader.js:841:27)
    at Function.executeUserEntryPoint [as runMain]
 (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

The project folder looks fine and seems to have all the dependencies.

Also the build works if npm install is skipped !!

build	07-Aug-2020 12:28:29	[INFO]
 Scanning classes to find frontend configurations and dependencies...
build	07-Aug-2020 12:28:31	[INFO]
 Visited 1395 classes. Took 2018 ms.
build	07-Aug-2020 12:28:31	[INFO]
 Skipping `npm install`.

I think this is related to the following thread.

https://vaadin.com/forum/thread/17849507/statistics-usage-copyfile-problem

I set up a build directory on the build server and used just maven to build the project and I got the same problem.

mkdir testproject
cd testproject 

Copy the frontend/ src/ and pom.xml into the test project folder.
All files owned by root including the testproject folder

mvn package -Pproduction

The build fails with the error about not finding the vaadin-usages-statistics.js file.

If I set the project directory permissions and files it contains to something other than root.

chown -R user:user testproject/ 

The build completes successfully.

Does npm have an inbuilt guard against overwriting a file owned by root ? I think this is how the vaadin-usage-statistics is managed. If it is not enabled the vaadin-usage-statistics.js file is overwritten with a file that has a “do nothing” function i.e. vaadin-usage-statistics-optout.js