rethinkdb-migrate migration file in location - rethinkdb

I am using rethinkdb-migrate for migrating rethink db database object.
I am running the following command -
rethinkdb-migrate up --db=test
When the migration file is in migrations folder it's working as expected.
but when I am moving the migration folder within another folder ( db ), it's not working.
rethinkdb-migrate up --file /db/migrations/20180725062631-scehma.js --db=test
The above command gives following error -
/home/bappaditya/.nvm/versions/node/v8.11.3/lib/node_modules/rethinkdb-migrate/node_modules/yargs/yargs.js:1133
else throw err
^
Error: Cannot find module '/db/migrations/20180725062631-scehma.js'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at readOptionsFile (/home/bappaditya/.nvm/versions/node/v8.11.3/lib/node_modules/rethinkdb-migrate/bin/rethinkdb-migrate:140:10)
at buildOptions (/home/bappaditya/.nvm/versions/node/v8.11.3/lib/node_modules/rethinkdb-migrate/bin/rethinkdb-migrate:120:21)
at runMigrations (/home/bappaditya/.nvm/versions/node/v8.11.3/lib/node_modules/rethinkdb-migrate/bin/rethinkdb-migrate:96:19)
at Object.runCommand (/home/bappaditya/.nvm/versions/node/v8.11.3/lib/node_modules/rethinkdb-migrate/node_modules/yargs/lib/command.js:235:44)
at Object.parseArgs [as _parseArgs] (/home/bappaditya/.nvm/versions/node/v8.11.3/lib/node_modules/rethinkdb-migrate/node_modules/yargs/yargs.js:1046:30)
at Object.get [as argv] (/home/bappaditya/.nvm/versions/node/v8.11.3/lib/node_modules/rethinkdb-migrate/node_modules/yargs/yargs.js:989:21)
I triple checked, 20180725062631-scehma.js exists in db/migrations

Maybe you have misspelled the name of the file, "-scehma" to "-schema" :
rethinkdb-migrate up --file /db/migrations/20180725062631-scehma.js --db=test
It should be:
rethinkdb-migrate up --file /db/migrations/20180725062631-schema.js --db=test

Unless your db folder is in the root, you shouldn't use the leading slash.
So instead of:
rethinkdb-migrate up --file /db/migrations/20180725062631-scehma.js --db=test
Use:
rethinkdb-migrate up --file db/migrations/20180725062631-scehma.js --db=test

Related

Composer Update Failed cannot open shared object file:

I just run
composer update
but I got this
Failed loading ./opcache.so: ./opcache.so: cannot open shared object file: No such file or directory
PHP Warning: PHP Startup: Unable to load dynamic library './pdo.so' - ./pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library './calendar.so' - ./calendar.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library './ctype.so' - ./ctype.so: cannot open shared object file: No such file or directory in Unknown on line 0
... so on
I run php -i and got this
Loaded Configuration File => /etc/php/7.0/cli/php.ini
Scan this dir for additional .ini files => /etc/php/7.0/cli/conf.d
Additional .ini files parsed => /etc/php/7.0/cli/conf.d/10-opcache.ini,
/etc/php/7.0/cli/conf.d/10-pdo.ini,
/etc/php/7.0/cli/conf.d/20-calendar.ini,
/etc/php/7.0/cli/conf.d/20-ctype.ini,
... so on
How do I fix it?
Thanks in Advance.
Your php can not find the dlls. To solve it:
Run php -i and find your php.ini location under Loaded Configuration File key.
Search for the dll files php unable to load and find their full path
Update the extension key in your php.ini to the full dll path
for example:
extension=<path>/php_pdo_firebird.dll
extension=<path>/php_pdo_mysql.dll'
extension=<path>/php_pdo_pgsql.dll:
composer use php.ini in /etc/php/7.0/cli/php.ini looks like you uncoment extension_dir
just comment, and reload apache and you done it.

Error "Cannot find module 'errors.server.controller.js'" while trying to extend default backend

I want to add new code to my backend, which will put some data to MongoDB collection. I decided to do it in core.server.controller.js because my app will be really simple and I don't need to create a new module for this. So I opened /app/controllers/users/users.profile.server.controller.js, a mean.js built-in controller and copied
var _ = require('lodash'),
errorHandler = require('../errors.server.controller.js'),
mongoose = require('mongoose'),
passport = require('passport'),
User = mongoose.model('User');
to core.server.controller.js file to provide mongoose and the other stuff. Then I removed ../ from errorHandler require argument and changed mongoose model name to my own, which I've created before.
But when I want to start this app in console, I get an error:
Error: Cannot find module 'errors.server.controller.js'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/developer2/baca/app/controllers/core.server.controller.js:7:17)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at module.exports (/Users/developer2/baca/app/routes/core.server.routes.js:5:13)
at /Users/developer2/baca/config/express.js:118:35
at Array.forEach (native)
at module.exports (/Users/developer2/baca/config/express.js:117:49)
at Object.<anonymous> (/Users/developer2/baca/server.js:24:38)
So how can I fix this?
You are requiring errors.server.controller.js however the path is wrong.
You can either use the file path relative to your app root directory or to the file (core.server.controller.js) from where you're requiring:
Solution 1: Path relative to the app root directory (preferred for the sake of consistency since MEAN.js uses path for requires in other js files):
You can use node path module to help you with this like so:
var path = require('path),
errorHandler = require(path.resolve('./modules/core/server/controllers/errors.server.controller.js'));
Note that the file path is relative to the root directory of your app and path module will handle that for you.
Solution 2: Path relative to the current file:
Since they are both in the same directory:
var errorHandler = require('./errors.server.controller.js');

Cannot find module twilio when using heroku and meteor

I cannot figure out how to get the twilio npm module working on a heroku dyno using meteor js. It works great on localhost, but it crashes on heroku. This is how I built my heroku app:
heroku create meteorherokutwilio --stack cedar --buildpack https://github.com/oortcloud/heroku-buildpack-meteorite.git
heroku config:add ROOT_URL=http://meteorherokutwilio.herokuapp.com/
heroku labs:enable websockets -a meteorherokutwilio
git push heroku master
I've added twilio to my meteor project like this:
mrt add twilio
This is how I'm loading twilio:
var client = Npm.require('twilio')("key", "secret");
This is the error:
/app/.meteor/heroku_build/app/programs/server/boot.js:186
}).run();
^
Error: Cannot find module 'twilio'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.Npm.require (/app/.meteor/heroku_build/app/programs/server/boot.js:88:18)
at app/meteor-heroku-twilio.js:18:24
at /app/.meteor/heroku_build/app/programs/server/boot.js:159:61
at Array.forEach (native)
at Function._.each._.forEach (/app/.meteor/heroku_build/app/programs/server/node_modules/underscore/underscore.js:79:11)
at /app/.meteor/heroku_build/app/programs/server/boot.js:159:5
Process exited with status 8
State changed from starting to crashed
I've also made a git repo with the minimum amount of code to demonstrate the problem: https://github.com/esromneb/meteor-heroku-twilio/
Npm.require works only for standard node packages (well, it works for packages it found installed, but you should only rely on it for standard packages, unless you want to manually add packages to your Heroku server and each server you'd like to run in the future).
For all other npm packages, there's npm meteorite package.
Add it to your project with mrt add npm command.
Then create packages.json file with a list of all required packages, for example:
{
"twilio": "1.5.0",
"oauth": "0.9.11"
}
Afterwards, include your package with Meteor.require:
var client = Meteor.require('twilio')("key", "secret");

Can't run Google Coder on Mac

I'm trying to run Google Coder on Mac following the following instructions:
http://pi.gadgetoid.com/article/running-google-coder-on-your-existing-raspberry-pi-or-desktop-pc
Everything goes well until I have to launch the server. This is what I get:
node server.js
module.js:340
throw err;
^
Error: Cannot find module '/Users/sebasribas/Downloads/coder-master/coder-base/apps/auth/app'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at pingStatusServer (/Users/sebasribas/Downloads/coder-master/coder-base/server.js:187:23)
at Object.<anonymous> (/Users/sebasribas/Downloads/coder-master/coder-base/server.js:278:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
Any suggestion?
Thanks a lot for your help.
Found this here: https://github.com/googlecreativelab/coder/issues/56
You'll need to install the relevant apps before it'll work.
cd ~/coder-dist/coder-apps/
Install the base apps that are common to all platforms:
./install_common.sh ../coder-base/
This copies the common platform apps to the coder-base working directory.
By looking at your error log you're missing a module. Did you run 'npm install' in the coder-base directory after downloading it?
A little tedious, I'm sure there's a more automated way, but...
Follow the robot instructions in coder-apps/install_app.sh
Basically, you copy the app directories from coder-apps/common into three places:
coder-base/apps
coder-base/static
coder-base/views
So that in each of these directories there is a folder per-app.
Then, copy the contents of those app's respective 'app', 'static', and 'views' folders into the root of the application directory.
For example- in coder-base/apps, for the "auth" app, I copied /app/app.js and /app/meta.json into the root level of the directory that I just created: coder-base/apps/auth.
You don't have to copy all the sample apps, but you definitely need at least the auth, editor, boilerplate, and coderlib.
I'd just copy them all to be safe!
Have fun hacking :)

node.js shell environment variable conflict with cakephp

I have set cakes environment path in my .profile file, but it seems the
> cake
has taken by node.js coffeescript, and outputs the following error
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cakefile not found in /Users/Devric
at /opt/local/lib/node_modules/coffee-script/lib/coffee-script/cake.js:96:11
at /opt/local/lib/node_modules/coffee-script/lib/coffee-script/cake.js:95:32
at /opt/local/lib/node_modules/coffee-script/lib/coffee-script/cake.js:95:32
at Object.run (/opt/local/lib/node_modules/coffee-script/lib/coffee-script/cake.js:46:19)
at Object.<anonymous> (/opt/local/lib/node_modules/coffee-script/bin/cake:7:38)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Array.0 (module.js:470:10)
Fixed the issue, by renaming the cake shell for cakephp to cakes, so that it won't conflict with the coffeescript cake file.

Resources