Closed wakandan closed 10 years ago
It doesn't install globally this way... You need to specify the path to the mongo-migrate directory when running it.
For example:
//This will install it to [currentDirectory]\node_modules\mongo-migrate
npm install mongo-migrate
Then to run it from that same directory you installed it from you would put:
node ./node_modules/mongo-migrate -runmm
Just spent 30 minutes trying to figure out why I wasn't able to create a migration. Plus your README.md doesn't state any of this. Shouldn't node mongo-migrate
automatically be looking for the mongo-migrate module from within the ./node_modules folder?
Anyway to add some functionality of being able to automatically search for the ./node_modules folder and maybe a command to automatically set some config options instead of having to put -c ../some/other/directory where migrations will be at, which typically would be in ./app/migrations??
+1.
crazy! why doesnt node pickup mongo-migrate automatically form ./node_modules
directory ?
Not sure why it doesn't automatically pick it up from within the node_modules folder... I'm not actively using this module anymore, but if you'd like to look into it and issue a pull request with a fix I'd be happy to merge it in and re-publish to npm
Node only checks the node_modules
folder when you're require()
ing a file. It doesn't have any special logic like that when you're passing a script to the node binary itself, though (other than letting the .js
extension be optional). The need to specify the path to the script probably just needs to be documented somewhere.
Good call @jmar777! :+1: I guess when I wrote the readme I just assumed that was a given... lol
Cant we use preferGlobal
option in mongo-migrate's package.json?
mongo-migrate will ideally be used as a command line tool. So giving that option in package.json will make npm install
command it globally in the system. Checkout the docs - https://www.npmjs.org/doc/files/package.json.html
Express, for example, if we want to use its command line tool express-generator
, the library recommends us to install globally like npm install -g
so that the command becomes available in system PATH. We can recommend that in the README.
My node doesn't seem to be able to find your module for some reason. I followed the steps in README but doesn't work
npm install mongo-migrate node mongo-migrate --> Error: Cannot find module