Closed nidomiro closed 3 years ago
please provide more information:
v
before the version? (mongodb names some with and some without v
infront)
- if there was an error (or any logs on the console), please provide it
no error.
$ npm install
added 1170 packages, and audited 1171 packages in 7s
1 package is looking for funding
run `npm fund` for details
found 0 vulnerabilities
- what system (/ distribution) are you running the install on
macOs Big Sur 11.2
- did you already try adding an v before the version? (mongodb names some with and some without v infront)
Using v4.4.5
or V4.4.5
as version changes nothing on install
- does the runtime download work?
yes, but I'd like to use the postinstall and not change the jest timeout
- did you already try this package's beta version?
v7.0.0-beta.38
does not download on install as well
All Tests where done with removed node_modules
here is the verbose install:
no error.
along with no actual log output (from this package), this is very weird, there should at least be an message that states Mongodb-Memory-Server* checking MongoDB binaries
or Could not find file "postinstall" in core package!
Using v4.4.5 or V4.4.5 as version changes nothing on install
i just tested, yes 4.4.5
is an valid version, generated downloadurl (an verified exists): https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.4.5.tgz
this is weird that the postinstall does nothing (in 6.x and 7.x)
only exception where it does nothing (not downloading anything, but still logging) is when the binary is already installed
could you try to run MONGOMS_DEBUG=1 npm install
(not an npm verbose install) in an project with an deleted node_modules
just running MONGOMS_DEBUG=1 npm install
results in the same output as just npm install
.
With log verbose I also get the same results:
npm info run mongodb-memory-server@7.0.0-beta.38 postinstall node_modules/mongodb-memory-server node ./postinstall.js
npm info run mongodb-memory-server@7.0.0-beta.38 postinstall { code: 0, signal: null }
even with "disablePostintall": "1"
there was no output - but I've seen a console.log in the postinstall script...
executing the postinstall-script directly seems to work (disablePostintall still enabled for testing):
cd node_modules/mongodb-memory-server && node ./postinstall.js
MongoMS:ResolveConfig findPackageJson: Found package.json at "/Users/myUser/workspace/someFolder/sandbox/poc-nestjs-mongoose-repository-testing/node_modules/mongodb-memory-server/package.json" +0ms
MongoMS:ResolveConfig findPackageJson: Found package.json at "/Users/myUser/workspace/someFolder/sandbox/poc-nestjs-mongoose-repository-testing/package.json" +2ms
MongoMS:ResolveConfig findPackageJson: Found package with non-empty config field at "/Users/myUser/workspace/someFolder/sandbox/poc-nestjs-mongoose-repository-testing/package.json" +0ms
Mongodb-Memory-Server* postinstall skipped because "DISABLE_POSTINSTALL" was set to an truthy value
But why doesn't it work when triggered by npm ?!
as a workaround I'm currently adding "postinstall": "cd node_modules/mongodb-memory-server && node ./postinstall.js",
to the scripts
of my package.json
But why doesn't it work when triggered by npm ?!
i have also no clue
Got the same problem with "mongodb-memory-server": "^6.9.6". I am starting a Docker container first docker build -t test . --build-arg NPM_TOKEN=$NPM_TOKEN --target test && docker run -it --rm test && docker rmi test
Tests fail as JEST timeout is too short:
@rstoermer already tried the latest beta version? (7.0.0-beta.38
)
@rstoermer already tried the latest beta version? (
7.0.0-beta.38
)
No, but would be willing to. Where can I find instructions for migration?
Okay, more info, the file is being downloaded during install:
Still tests fail, as the file is downloaded again:
This is still on 6.9.6
Where can I find instructions for migration?
they are not complete (yet), but the most important stuff is listed on the Migration guide
could you also provide more information:
node_modules
also being copied into the containernode:14-alpine
)is the npm/yarn install being done inside or outside of the docker container (i already saw in the screenshot, but just to be sure)
Yes, inside!
is node_modules also being copied into the container
No
what is your host system (windows, macos, linux(distro))
macos
what is your docker base container (like node:14-alpine)
node:14.16.1
what is your docker base container (like node:14-alpine) node:14.16.1
so basically it is based on debian-stretch (which has an binary)
i forgot to ask, is the project folder copied or shared into the container?
for now, i dont know what the problem could be, please report back when having tried the beta (which includes many improvements for downloads / binary handling)
what is your docker base container (like node:14-alpine) node:14.16.1
so basically it is based on debian-stretch (which has an binary)
i forgot to ask, is the project folder copied or shared into the container?
for now, i dont know what the problem could be, please report back when having tried the beta (which includes many improvements for downloads / binary handling)
Its copied into the folder. Anyway, the beta works perfectly! :)
Hi @hasezoey do you mind checking this minimal repo? ~I'm not sure if this is an issue with pnpm or not, but~ Apparently it is not related to pnpm, and I think it's probably a cache issue.
After running the test
, lib tries to download the MongoDB as described above
and it fails and exits with timeout error while downloading the MongoDB
and leaving with these files stored in the root of the project
Seems like a possible solution to this problem is explicitly specifying the download path in package.json.
"config": {
"mongodbMemoryServer": {
"downloadDir": "./node_modules/mongodb-memory-server" // I assume the path can be anything
}
}
Otherwise, the package is trying to download the binary file while tests are running- even if the binary file has already downloaded at the initial installation stage aka. postinstall
😶
@seahindeniz thanks for reporting, made an clear issue stating the problem, #478
new insight after testing for #478:
package: mongo-memory-server / all other packages with postinstall
NPM 7.x does not log the output of an postinstall script
not yet
https://github.com/npm/cli/issues/3347
just try to install mongo-memory-server
in an blank npm project
or use the reproduction repository: https://github.com/seahindeniz/mongodb-memory-server-issue/tree/with-npm
@nidomiro / @rstoermer does upgrading the npm version (to 7.15.x or higher)
fix the issue?
for anyone that has / still has this issue, please run the following when using npm 7.x:
MONGOMS_DEBUG=1 npm i --foreground-scripts
and report the full output
look at this comment for why: https://github.com/npm/cli/issues/3347#issuecomment-854032079
Currently I have npm 7.13.0
installed and it seems to work without the workaround 👍
Versions
package: mongo-memory-server
What is the Problem?
No binaries of mongodb are downloaded on
npm install
. Setting"disablePostinstall": "0"
in the packege.json makes no differenceMy package.json (striped):
Do you know why it happenes?
no