Trouble building Compass from source

Hi everyone, I’m a bit of a Javascript newb trying to build Compass from source on Windows 10.

I cloned the source code from github at https://github.com/mongodb-js/compass.git

I’ve installed node and npm on this machine.
node -v v12.18.3 npm -v npm -v
6.14.6

I’ve also installed electron by running ‘npm install electron --save-dev’ and ‘npm install --save-dev hadron-build’.

I’m trying to run ‘npm start’ from within the compass subdirectory in a cygwin terminal. Running from within the windows command terminal fails at the ‘rm -rf .compiled-sources’ step. Here’s the error:

$ npm start
...


 Thu, 27 Aug 2020 04:34:42 GMT electron-squirrel-startup processing squirrel command `F:\compass`
2020-08-27T04:34:42.315Z hadron-auto-update-manager auto updater ready and waiting. {
  version: '1.22.0-dev.0',
  feedURL: 'https://compass.mongodb.com/api/v2/update/compass/stable/windows/1.22.0-dev.0'
}
2020-08-27T04:34:42.397Z mongodb-compass:menu init()
App threw an error during load
Error: Module did not self-register.
    at process.func (electron/js2c/asar.js:138:31)
    at process.func [as dlopen] (electron/js2c/asar.js:138:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:828:18)
    at Object.func (electron/js2c/asar.js:138:31)
    at Object.func [as .node] (electron/js2c/asar.js:138:31)
    at Module.load (internal/modules/cjs/loader.js:645:32)
    at Function.Module._load (internal/modules/cjs/loader.js:560:12)
    at Module.require (internal/modules/cjs/loader.js:685:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (F:\compass\node_modules\storage-mixin\node_modules\keytar\lib\keytar.js:1:14)
handling uncaughtException Error: Module did not self-register.
    at process.func (electron/js2c/asar.js:138:31)
    at process.func [as dlopen] (electron/js2c/asar.js:138:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:828:18)
    at Object.func (electron/js2c/asar.js:138:31)
    at Object.func [as .node] (electron/js2c/asar.js:138:31)
    at Module.load (internal/modules/cjs/loader.js:645:32)
    at Function.Module._load (internal/modules/cjs/loader.js:560:12)
    at Module.require (internal/modules/cjs/loader.js:685:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (F:\compass\node_modules\storage-mixin\node_modules\keytar\lib\keytar.js:1:14)
MongoDB Compass Dev has encountered an unexpected error: ${app.getName()} version ${app.getVersion()}
Stacktrace:
Error: Module did not self-register.
    at process.func (electron/js2c/asar.js:138:31)
    at process.func [as dlopen] (electron/js2c/asar.js:138:31)
    at Object.func (electron/js2c/asar.js:138:31)
    at Object.func [as .node] (electron/js2c/asar.js:138:31)
    at Object.<anonymous> (F:/compass/node_modules/storage-mixin/node_modules/keytar/lib/keytar.js:1:14)
F:\compass\node_modules\electron\dist\resources\electron.asar\browser\api\dialog.js:38
        throw new Error('dialog module can only be used after app is ready');
        ^

Error: dialog module can only be used after app is ready
    at checkAppInitialized (F:\compass\node_modules\electron\dist\resources\electron.asar\browser\api\dialog.js:
38:15)
    at messageBox (F:\compass\node_modules\electron\dist\resources\electron.asar\browser\api\dialog.js:97:5)
    at Object.showMessageBox (F:\compass\node_modules\electron\dist\resources\electron.asar\browser\api\dialog.j
s:157:16)
    at Object.showMessageBox (F:\compass\node_modules\electron\dist\resources\electron.asar\common\api\deprecate
.js:144:32)
    at process.<anonymous> (F:\compass\src\main\index.js:40:27)
    at process.emit (events.js:205:15)
    at process._fatalException (internal/process/execution.js:146:25)

Is this just some odd behavior from trying to build under the cygwin terminal under Windows? If so, what is the preferred method for building Compass from scratch on Windows?

Thank you all for your time

Hi @Justin_Hopkins!

If you’re building from source on Windows, you can try two things to get bypass that rm -rf .compiled_sources step:

  1. on line 225 in package.json, change the prestart script to: "prestart": "rd -r .compiled_sources". (rm -rf is not a windows command)
  2. If you get an error that says .compiled_sources file doesn’t exist, change that line to just have an empty command: "prestart": "". It should then compile!
2 Likes

Hi Irina,

Thank you for this suggestion. This did help me get past that step. After some further twiddling I realized I forgot to ran ‘npm install’ from inside the compass subdirectory. It is now compiled and running.

Cheers

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.