mongodb-memory-server: Mongod binary installing in the wrong directory of workspace PNPM
Versions
- NodeJS: 14.16.1
- mongodb-memory-server-*: 7.0.0-beta.49
- mongodb(the binary version): 4.0.25
- mongoose: 5.12.15
- system: Windows 10
package: mongo-memory-server
What is the Problem?
MMS = mongodb-memory-server
I use MMS in a package of workspace and after installing dependencies and running a test script in the package, MMS tries to download the binary file. But if I run the test command from the root folder of the workspace, MMS can find the binary file from node_modules/.cache
folder.
What I mean by root directory is: C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x
And what I meant by package directory is: C:\Users\Sahin\projects\temp\mongodb-memory-server-issue-x\packages\my-app
Here is the folder structure:
Code Example
Here is the minimal repo https://github.com/seahindeniz/mongodb-memory-server-issue-489
Do you know why it happenes?
I’m not sure why, but I guess postinstall script installs the binary file to the upper node_modules folder rather than installing to the closest node_modules folder and using it from the closest node_modules
. I guess it should work respectfully
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17
closing, because workaround (
PREFER_GLOBAL_PATH
) works andwontfix
labellike i said earlier, this temporary directory is only for the DataBase Path, not the Binary or Download path
and
preferGlobalPath
will install it into the current users home directory (on POSIX systems, its~/.cache/mongodb-binaries
, and on DOS systems, its%USERPROFILE%/.cache/mongodb-binaries
- both usingos.homedir()
)and as you can see by the output of
the binary is stored at
C:\Users\Sahin\.cache\mongodb-binaries\mongod-x64-win32-4.0.25.exe
DOWNLOAD_DIR
option is meant to be absolute, but if its not, then its implicitly resolved withprocess.cwd()
, which can be very wrong in an installif you mean the message from
_startUpInstance: Creating new MongoDB instance with options:
, then no, this package creates an temporary directory (in the system’s temp folder) to the database to use (mongod--dbPath
option)could you provide how you have set this? because it seems to have thrown an very weird error somehow (an value was not an string, where it should always have been an string, fixed with beta 50)
btw, if you want you can set
RUNTIME_DOWNLOAD
tofalse
, and it will error out instead of trying to download on runtimebeta 50 should be released soon (~10min), which includes some fixes i noticed from the logs
PS: thanks to the reproduction repo, i will now try to use pnpm and the repo in an VM