Error building mongosh

Been months since I tried to build mongosh

Now it’s bottoming out here, any tips?

> @mongosh/build@0.0.0-dev.0 evergreen-release
> ts-node -r ../../scripts/import-expansions.js src/index.ts "compile"


/work/jwoehr/MongoDB/mongosh/node_modules/bindings/bindings.js:126
  err = new Error(
        ^
Error: Could not locate the bindings file. Tried:
 → /work/jwoehr/MongoDB/mongosh/node_modules/deasync/build/deasync.node
 → /work/jwoehr/MongoDB/mongosh/node_modules/deasync/build/Debug/deasync.node
 → /work/jwoehr/MongoDB/mongosh/node_modules/deasync/build/Release/deasync.node
 → /work/jwoehr/MongoDB/mongosh/node_modules/deasync/out/Debug/deasync.node
 → /work/jwoehr/MongoDB/mongosh/node_modules/deasync/Debug/deasync.node
 → /work/jwoehr/MongoDB/mongosh/node_modules/deasync/out/Release/deasync.node
 → /work/jwoehr/MongoDB/mongosh/node_modules/deasync/Release/deasync.node
 → /work/jwoehr/MongoDB/mongosh/node_modules/deasync/build/default/deasync.node
 → /work/jwoehr/MongoDB/mongosh/node_modules/deasync/compiled/16.3.0/linux/x64/deasync.node
 → /work/jwoehr/MongoDB/mongosh/node_modules/deasync/addon-build/release/install-root/deasync.node
 → /work/jwoehr/MongoDB/mongosh/node_modules/deasync/addon-build/debug/install-root/deasync.node
 → /work/jwoehr/MongoDB/mongosh/node_modules/deasync/addon-build/default/install-root/deasync.node
 → /work/jwoehr/MongoDB/mongosh/node_modules/deasync/lib/binding/node-v93-linux-x64/deasync.node
    at bindings (/work/jwoehr/MongoDB/mongosh/node_modules/bindings/bindings.js:126:9)
    at Object.<anonymous> (/work/jwoehr/MongoDB/mongosh/node_modules/deasync/index.js:30:31)
    at Module._compile (node:internal/modules/cjs/loader:1109:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
    at Object.require.extensions.<computed> [as .js] (/work/jwoehr/MongoDB/mongosh/node_modules/ts-node/src/index.ts:1045:43)
    at Module.load (node:internal/modules/cjs/loader:989:32)
    at Function.Module._load (node:internal/modules/cjs/loader:829:14)
    at Module.require (node:internal/modules/cjs/loader:1013:19)
    at require (node:internal/modules/cjs/helpers:93:18)

Hi Jack!

This is something I occasionally run into as well - it most likely means that you’re trying to run the build step with Node.js 16, and have run a previous install step with another Node.js version.

We’re currently doing all of our work on mongosh with Node.js 14, so I’d recommend you do the same. Hope this helps!

Thanks @Anna_Henningsen … as I noted, it’s been a while since I was following the evolution of mongosh … is it still correct to build using these 2 command lines?

npm run bootstrap
npm run compile-exec

BTW …

$ nvm ls
       v12.18.4
        v14.2.0
->      v14.5.0
       v14.15.3
        v16.3.0
default -> v14.5.0
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v16.3.0) (default)
stable -> 16.3 (-> v16.3.0) (default)
lts/* -> lts/fermium (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.1 (-> N/A)
lts/fermium -> v14.17.0 (-> N/A)

Here’s the failure log.

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/home/jwoehr/.nvm/versions/node/v14.5.0/bin/node',
1 verbose cli   '/home/jwoehr/.nvm/versions/node/v14.5.0/bin/npm',
1 verbose cli   'run',
1 verbose cli   'evergreen-release',
1 verbose cli   '--',
1 verbose cli   'compile'
1 verbose cli ]
2 info using npm@6.14.10
3 info using node@v14.5.0
4 verbose run-script [
4 verbose run-script   'preevergreen-release',
4 verbose run-script   'evergreen-release',
4 verbose run-script   'postevergreen-release'
4 verbose run-script ]
5 info lifecycle @mongosh/build@0.0.0-dev.0~preevergreen-release: @mongosh/build@0.0.0-dev.0
6 info lifecycle @mongosh/build@0.0.0-dev.0~evergreen-release: @mongosh/build@0.0.0-dev.0
7 verbose lifecycle @mongosh/build@0.0.0-dev.0~evergreen-release: unsafe-perm in lifecycle true
8 verbose lifecycle @mongosh/build@0.0.0-dev.0~evergreen-release: PATH: /home/jwoehr/.nvm/versions/node/v14.5.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/work/jwoehr/MongoDB/mongosh/packages/build/node_modules/.bin:/home/jwoehr/.nvm/versions/node/v14.5.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/work/jwoehr/MongoDB/mongosh/node_modules/.bin:/home/jwoehr/.nvm/versions/node/v14.5.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/work/jwoehr/MongoDB/mongosh/node_modules/.bin:/home/jwoehr/.nvm/versions/node/v14.5.0/bin:/home/jwoehr/.local/bin:/home/jwoehr/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/jwoehr/work/jwoehr/gopath/bin
9 verbose lifecycle @mongosh/build@0.0.0-dev.0~evergreen-release: CWD: /work/jwoehr/MongoDB/mongosh/packages/build
10 silly lifecycle @mongosh/build@0.0.0-dev.0~evergreen-release: Args: [
10 silly lifecycle   '-c',
10 silly lifecycle   'ts-node -r ../../scripts/import-expansions.js src/index.ts "compile"'
10 silly lifecycle ]
11 silly lifecycle @mongosh/build@0.0.0-dev.0~evergreen-release: Returned: code: 1  signal: null
12 info lifecycle @mongosh/build@0.0.0-dev.0~evergreen-release: Failed to exec evergreen-release script
13 verbose stack Error: @mongosh/build@0.0.0-dev.0 evergreen-release: `ts-node -r ../../scripts/import-expansions.js src/index.ts "compile"`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/home/jwoehr/.nvm/versions/node/v14.5.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:314:20)
13 verbose stack     at ChildProcess.<anonymous> (/home/jwoehr/.nvm/versions/node/v14.5.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:314:20)
13 verbose stack     at maybeClose (internal/child_process.js:1051:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid @mongosh/build@0.0.0-dev.0
15 verbose cwd /work/jwoehr/MongoDB/mongosh/packages/build
16 verbose Linux 5.11.14-200.fc33.x86_64
17 verbose argv "/home/jwoehr/.nvm/versions/node/v14.5.0/bin/node" "/home/jwoehr/.nvm/versions/node/v14.5.0/bin/npm" "run" "evergreen-release" "--" "compile"
18 verbose node v14.5.0
19 verbose npm  v6.14.10
20 error code ELIFECYCLE
21 error errno 1
22 error @mongosh/build@0.0.0-dev.0 evergreen-release: `ts-node -r ../../scripts/import-expansions.js src/index.ts "compile"`
22 error Exit status 1
23 error Failed at the @mongosh/build@0.0.0-dev.0 evergreen-release script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Yes – that should still work and is essentially what we do in CI as well.

Is it still failing with the same error (“Could not locate the bindings file”) when using Node.js 14? If so, you may need to remove the top-level node_modules folder first and re-bootstrap using Node.js 14 as well.

Build successfully!
1 mistake and 1 omission on my part:

  1. I was doing an “npm audit” after the bootstrap, must introduce incompatibilities.
  2. I did export SEGMENT_API_KEY="dummy" before the build.

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