Cannot build lorawan stack

Running tools/bin/mage js:build fails while following the development instructions on github. I’m on the 3.10.1 tag in the hope it would be more stable but I see similar issues on top of the default branch.

$ tools/bin/mage js:build
Skipping DLL building (production mode)
npm ERR! Cannot read property 'matches' of undefined

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/dsmith/.npm/_logs/2020-11-24T07_15_22_993Z-debug.log
node:internal/modules/cjs/loader:903
  throw err;
  ^

Error: Cannot find module 'yargs'
Require stack:
- /mnt/c/workspace/lorawan-stack/tools/mage/translations.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:900:15)
    at Function.Module._load (node:internal/modules/cjs/loader:745:27)
    at Module.require (node:internal/modules/cjs/loader:972:19)
    at require (node:internal/modules/cjs/helpers:88:18)
    at Object.<anonymous> (/mnt/c/workspace/lorawan-stack/tools/mage/translations.js:20:15)
    at Module._compile (node:internal/modules/cjs/loader:1083:30)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)
    at Module.load (node:internal/modules/cjs/loader:948:32)
    at Function.Module._load (node:internal/modules/cjs/loader:789:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:72:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/mnt/c/workspace/lorawan-stack/tools/mage/translations.js' ]
}
error Command "babel" not found.
npm ERR! code 1
npm ERR! path /mnt/c/workspace/lorawan-stack
npm ERR! command failed
npm ERR! command sh -c yarn babel pkg/webui

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/dsmith/.npm/_logs/2020-11-24T07_15_23_623Z-debug.log
Error: failed to install yarn: running "npm install --no-package-lock --no-save --production=false yarn" failed with exit code 1
running "node tools/mage/translations.js --backend-messages config/messages.json --locales pkg/webui/locales/.backend --backend-only" failed with exit code 1
running "npx yarn babel pkg/webui" failed with exit code 1

Hey @dsmith, did you try following the console troubleshoot guide of the development instructions? Specifically this section?

Also, please try the following commands: tools/bin/mage jsSDK:cleanDeps jsSDK:clean js:cleanDeps js:clean js:build, which will clean up all caches and modules. This often fixes build issues.

Thanks Kevin, I hadn’t seen that troubleshooting guide. I’m afraid I’m still seeing the same issues though. After yarn cache clean and npm cache clean --force this is what I get:

dsmith@machine:/mnt/c/workspace/lorawan-stack$ tools/bin/mage jsSDK:cleanDeps jsSDK:clean js:cleanDeps js:clean
dsmith@machine:/mnt/c/workspace/lorawan-stack$ tools/bin/mage jsSDK:cleanDeps js:deps
yarn install v1.22.10
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.12: The platform "linux" is incompatible with this module.
info "fsevents@1.2.12" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.2: The platform "linux" is incompatible with this module.
info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
yarn run v1.22.10
$ node util/http-mapper.js
File saved.........] \ idealTree:lorawan-stack: sill idealTree buildDeps
Done in 0.17s.
npm ERR! Cannot read property 'matches' of undefined

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/dsmith/.npm/_logs/2020-11-25T04_59_25_246Z-debug.log
[4/4] Building fresh packages...
Done in 83.52s.
yarn run v1.22.10
$ rm -rf dist; babel src -d dist
Successfully compiled 35 files with Babel.
Done in 39.20s.
Error: failed to install yarn: running "npm install --no-package-lock --no-save --production=false yarn" failed with exit code 1

This topic was automatically closed after 30 days. New replies are no longer allowed.