seppevs / migrate-mongo

A database migration tool for MongoDB in Node
MIT License
931 stars 166 forks source link

Possible To Run migrate-mongo Without Installing Globally? #217

Closed JimLynchCodes closed 4 years ago

JimLynchCodes commented 4 years ago

Hi, I am trying to use this on my build server where I can't install things globally.

I was trying to run it like this: ./node_modules/migrate-mongo/bin/migrate-mongo.js up

However, when doing that I get this error output:

✘  18:27 /a/work/hawk/services/activity-api [ feature/migrations | ✚ 2 …1 ⚑ 2 ] $ ./node_modules/migrate-mongo/bin/migrate-mongo.js up
ERROR: Cannot find module '/a/work/hawk/services/activity-api/migrate-mongo-config.js'
Require stack:
- /a/work/hawk/services/activity-api/node_modules/migrate-mongo/lib/env/configFile.js
- /a/work/hawk/services/activity-api/node_modules/migrate-mongo/lib/env/migrationsDir.js
- /a/work/hawk/services/activity-api/node_modules/migrate-mongo/lib/actions/init.js
- /a/work/hawk/services/activity-api/node_modules/migrate-mongo/lib/migrate-mongo.js
- /a/work/hawk/services/activity-api/node_modules/migrate-mongo/bin/migrate-mongo.js

Appreciate any help on this. 🙏

Thanks!

santiq commented 4 years ago

Did you try NPX?

gitbugr commented 4 years ago

Having the same issue. Different errors for me though.

Did you try NPX?

➜ npm run mm status       

> rs@ mm /Users/kyron/Documents/dev/rs
> npx -p migrate-mongo migrate-mongo "status"

npx: installed 38 in 7.55s
(node:99589) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:99589) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
(node:99589) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
(node:99589) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency

edit: now I think about it, it may be that I'm not running mongo atm...

gilles-yvetot commented 4 years ago

I am running it locally:

MrEmanuel commented 4 years ago

@gitbugr your error is because of something else. See issue 222

seppevs commented 4 years ago

npx migrate-mongo status seems to work for me? The error of OP seems that he's in the wrong directory.

I'm closing this issue. Feel free the reopen when necessary.