-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mongosh package uses wrong node version v14.20.0 but needs >= 16.15.0 #187337
Comments
I tried updating this by cloning nixpkgs and making this change: modified pkgs/development/tools/mongosh/generate.sh
@@ -16,6 +16,6 @@ node2nix \
--output gen/packages.nix \
--composition gen/composition.nix \
--strip-optional-dependencies \
- --nodejs-14
+ --nodejs-16
popd 1>/dev/null Then I ran ./generate.sh and saw it changed stuff, then did this: $ nix-build -A mongosh
/nix/store/9a7k7jmsznjqjwsv0dwl5mhyannvga41-mongosh-1.5.4
$ nix-build -A mongosh
/nix/store/9a7k7jmsznjqjwsv0dwl5mhyannvga41-mongosh-1.5.4
$ /nix/store/9a7k7jmsznjqjwsv0dwl5mhyannvga41-mongosh-1.5.4/lib/node_modules/mongosh/
bin/ node_modules/
$ /nix/store/9a7k7jmsznjqjwsv0dwl5mhyannvga41-mongosh-1.5.4/lib/node_modules/mongosh/bin/mongosh.js
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module '@mongosh/errors'
Require stack:
- /nix/store/9a7k7jmsznjqjwsv0dwl5mhyannvga41-mongosh-1.5.4/lib/node_modules/mongosh/node_modules/@mongosh/cli-repl/lib/arg-parser.js
- /nix/store/9a7k7jmsznjqjwsv0dwl5mhyannvga41-mongosh-1.5.4/lib/node_modules/mongosh/node_modules/@mongosh/cli-repl/lib/index.js
- /nix/store/9a7k7jmsznjqjwsv0dwl5mhyannvga41-mongosh-1.5.4/lib/node_modules/mongosh/node_modules/@mongosh/cli-repl/lib/run.js
- /nix/store/9a7k7jmsznjqjwsv0dwl5mhyannvga41-mongosh-1.5.4/lib/node_modules/mongosh/bin/mongosh.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/nix/store/9a7k7jmsznjqjwsv0dwl5mhyannvga41-mongosh-1.5.4/lib/node_modules/mongosh/node_modules/@mongosh/cli-repl/lib/arg-parser.js:7:18)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/nix/store/9a7k7jmsznjqjwsv0dwl5mhyannvga41-mongosh-1.5.4/lib/node_modules/mongosh/node_modules/@mongosh/cli-repl/lib/arg-parser.js',
'/nix/store/9a7k7jmsznjqjwsv0dwl5mhyannvga41-mongosh-1.5.4/lib/node_modules/mongosh/node_modules/@mongosh/cli-repl/lib/index.js',
'/nix/store/9a7k7jmsznjqjwsv0dwl5mhyannvga41-mongosh-1.5.4/lib/node_modules/mongosh/node_modules/@mongosh/cli-repl/lib/run.js',
'/nix/store/9a7k7jmsznjqjwsv0dwl5mhyannvga41-mongosh-1.5.4/lib/node_modules/mongosh/bin/mongosh.js'
]
} I'm not sure why this happened or what to do now. |
Additionally there's no bin at the top level like there was for the old version:
I think this is a node2nix regression as described in svanderburg/node2nix#293. |
Another related: #145432. |
Some extra context: I'm only trying to use mongosh because nixpkgs didn't have a new enough mongo version packaged that would work. It looks like there was a WIP PR to fix newer mongo versions but it seems to have stalled out. This means that you can't currently connect to mongo with mongosh or the mongo cli that predates it for newer mongo server versions. |
Hi @ParetoOptimalDev, thanks for the report! Indeed, MongoDB things are a little bit complicated at Nix, mostly because of license and packaging issues, I was trying to fix it just to not leave it at a broken state at nixpkgs, but time is a complicated investment. If you are in a hurry, I suggest that you use mongodb-compass, the expression is not perfect (I still need to find time to fix some crash issues) but it does have an embedded mongosh that you can use. The other alternative is to use a container linked to your host network to access your db. For mongosh specifically, I do not have knowledge about node packages too, but a few experiments here and there, and I get the same results that you related, I think it is best to ping @aaronjheng as the package maintainer, maybe he can help us. |
See #181680 |
This should be fixed by #193337 which brings |
Great work! I did a simple test. Now I can build the latest mongosh with nodejs 16. I will do more tests within this week. |
Describe the bug
mongosh is currently using the wrong node version.
I don't know how to override a node2nix derivation and my attempts with
override
andoverrideAttrs
have failed, probably because you need to override the nodePackages too and I couldn't figure that out.Steps To Reproduce
Steps to reproduce the behavior:
$ nix run nixpkgs#mongosh MongoshWarning: [CLIREPL-10001] Mismatched node version. Required version: >=16.15.0. Currently using: v14.20.0. Exiting...
Expected behavior
printing mongosh help for the example above, but more generally connecting to a mongo server such as one started with:
Additional context
Add any other context about the problem here.
Notify maintainers
@Mindavi @bryanasdev000 @andersk
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.$ nix-shell -p nix-info --run "nix-info -m"
this path will be fetched (0.06 MiB download, 0.30 MiB unpacked):
/nix/store/zk04408i3ljavv2i8yd43dh5sc0adz67-bash-interactive-5.1-p16-dev
copying path '/nix/store/zk04408i3ljavv2i8yd43dh5sc0adz67-bash-interactive-5.1-p16-dev' from 'https://cache.nixos.org'...
"x86_64-linux"
Linux 5.15.59, NixOS, 22.11 (Raccoon), 22.11.20220814.b02538b
yes
yes
nix-env (Nix) 2.10.3
"home-manager, nixos-21.03pre261529.d9dba88d08a, nixos-20.09-20.09.2497.4a75ca4a4e7"
/nix/store/0c10w4am1xhxjkrmnd8d6rbksvm68311-source
The text was updated successfully, but these errors were encountered: