Error during build of jsscripting: Can not find mudule

  • Platform information:
    • Hardware: Apple M1 Max / 32GB Ram / 1TB Storage
    • OS: macOS Monterey 12.6
    • Java Runtime Environment: openjdk 17.0.4.1 2022-08-12
    • openHAB version: 3.4.0-SNAPSHOT (current main branch)
    • maven version: Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
    • npm version: 8.19.2
    • node version: 18.10.0
  • Issue of the topic:
    I tried to build the sources on command line (no IDE involved) like it was described in the README.md: mvn clean install -DskipChecks -DskipTests
    Unfortunately I the build stops after a while with an npm error Cannot find module … (please see detailed error log below).
    Does anyone have an idea what is wrong with my build. Anybody had a similar issue?

Thank you for your help.
Best regards.
Patrick.

  • If logs where generated please post these here using code fences:
...
[INFO] --- frontend-maven-plugin:1.12.0:npm (npm install) @ org.openhab.automation.jsscripting ---
[INFO] Running 'npm install openhab@2.0.3 webpack webpack-cli' in /Users/patrick/dev/github/3rd_public/openhab-addons/bundles/org.openhab.automation.jsscripting/target/js
[INFO] npm WARN saveError ENOENT: no such file or directory, open '/Users/patrick/package.json'
[INFO] npm WARN enoent ENOENT: no such file or directory, open '/Users/patrick/package.json'
[INFO] npm WARN patrick No description
[INFO] npm WARN patrick No repository field.
[INFO] npm WARN patrick No README data
[INFO] npm WARN patrick No license field.
[INFO] 
[INFO] + openhab@2.0.3
[INFO] + webpack-cli@4.10.0
[INFO] + webpack@5.74.0
[INFO] updated 3 packages and audited 182 packages in 1.271s
[INFO] 
[INFO] 11 packages are looking for funding
[INFO]   run `npm fund` for details
[INFO] 
[INFO] found 0 vulnerabilities
[INFO] 
[INFO] 
[INFO] --- frontend-maven-plugin:1.12.0:npx (npx webpack) @ org.openhab.automation.jsscripting ---
[INFO] Running 'npx webpack -c ./node_modules/openhab/webpack.config.js --entry ./node_modules/openhab/ -o ./dist' in /Users/patrick/dev/github/3rd_public/openhab-addons/bundles/org.openhab.automation.jsscripting/target/js
[INFO] [webpack-cli] Failed to load '/Users/patrick/dev/github/3rd_public/openhab-addons/bundles/org.openhab.automation.jsscripting/target/js/node_modules/openhab/webpack.config.js' config
[INFO] [webpack-cli] Error: Cannot find module '/Users/patrick/dev/github/3rd_public/openhab-addons/bundles/org.openhab.automation.jsscripting/target/js/node_modules/openhab/webpack.config.js'
[INFO] Require stack:
[INFO] - /Users/patrick/node_modules/webpack-cli/lib/webpack-cli.js
[INFO] - /Users/patrick/node_modules/webpack-cli/lib/bootstrap.js
[INFO] - /Users/patrick/node_modules/webpack-cli/bin/cli.js
[INFO] - /Users/patrick/node_modules/webpack/bin/webpack.js
[INFO]     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
[INFO]     at Function.Module._load (internal/modules/cjs/loader.js:864:27)
[INFO]     at Module.require (internal/modules/cjs/loader.js:1044:19)
[INFO]     at require (internal/modules/cjs/helpers.js:77:18)
[INFO]     at WebpackCLI.tryRequireThenImport (/Users/patrick/node_modules/webpack-cli/lib/webpack-cli.js:204:22)
[INFO]     at loadConfigByPath (/Users/patrick/node_modules/webpack-cli/lib/webpack-cli.js:1404:38)
[INFO]     at /Users/patrick/node_modules/webpack-cli/lib/webpack-cli.js:1454:88
[INFO]     at Array.map (<anonymous>)
[INFO]     at WebpackCLI.loadConfig (/Users/patrick/node_modules/webpack-cli/lib/webpack-cli.js:1454:68)
[INFO]     at WebpackCLI.createCompiler (/Users/patrick/node_modules/webpack-cli/lib/webpack-cli.js:1785:33) {
[INFO]   code: 'MODULE_NOT_FOUND',
[INFO]   requireStack: [
[INFO]     '/Users/patrick/node_modules/webpack-cli/lib/webpack-cli.js',
[INFO]     '/Users/patrick/node_modules/webpack-cli/lib/bootstrap.js',
[INFO]     '/Users/patrick/node_modules/webpack-cli/bin/cli.js',
[INFO]     '/Users/patrick/node_modules/webpack/bin/webpack.js'
[INFO]   ]
[INFO] }
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for openHAB Add-ons 3.4.0-SNAPSHOT:
[INFO] 
[INFO] openHAB Add-ons .................................... SUCCESS [ 14.386 s]
[INFO] openHAB Add-ons :: BOM ............................. SUCCESS [  0.010 s]
[INFO] openHAB Add-ons :: BOM :: Runtime Index ............ SUCCESS [  1.398 s]
[INFO] openHAB Add-ons :: BOM :: Test Index ............... SUCCESS [  0.245 s]
[INFO] openHAB Add-ons :: BOM :: openHAB Core Index ....... SUCCESS [  0.552 s]
[INFO] openHAB Add-ons :: Bundles ......................... SUCCESS [ 14.294 s]
[INFO] openHAB Add-ons :: Bundles :: Automation :: Groovy Scripting SUCCESS [  4.585 s]
[INFO] openHAB Add-ons :: Bundles :: Automation :: JRuby Scripting SUCCESS [  7.796 s]
[INFO] openHAB Add-ons :: Bundles :: Automation :: JSScripting FAILURE [  9.952 s]
...