How to solve 503 error in ejs expressjs server? - mysql

I am getting below log file: I tried different ways like ./models/db_controller.js and ../models/db_controller.js. But no use.
Error: Cannot find module './mynode/models/db_controller.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at Object.<anonymous> (/home/simawedl/mynode/controllers/home.js:3:23)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/home/simawedl/mynode/controllers/login.js:2:12)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
My folder structure like this. I am rendering files using ejs template engine using expressjs.
Below is the image for folder structure

Related

NodeJS jwtStrategy requires a function to retrieve jwt from requests error in MERN

C:\Users\Nalin\Desktop\devconnector\config\passport.js:2
jwtOptions.jwtFromRequest = ExtractJwt.fromAuthHeaderAsBearerToken();
^
ReferenceError: jwtOptions is not defined
at Object.<anonymous> (C:\Users\Nalin\Desktop\devconnector\config\passport.js:2:1)
at Module._compile (internal/modules/cjs/loader.js:654:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
at Module.require (internal/modules/cjs/loader.js:598:17)
at require (internal/modules/cjs/helpers.js:11:18)
at Object.<anonymous> (C:\Users\Nalin\Desktop\devconnector\server.js:29:1)
at Module._compile (internal/modules/cjs/loader.js:654:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
at startup (internal/bootstrap/node.js:201:19)
[nodemon] app crashed - waiting for file changes before starting...

Sequelize model error-tring to make model in sequelize and getting this error

Error 471--cannot find module!
This is the model I am tring to write.T
have data is already in mysql. Tring to connect from sequilize. I deleted all node module and tried again,nothing is working.Please suggest something.
module.exports = function(sequelize,dataTypes) {
var calender = sequelize.define("calender",{
listing_id:DATATYPE.INTEGER,
listdate:DATATYPE.DATE,
available:DATATYPE.TEXT,
price:DATATYPE.TEXT
});
return calender;
};
This is the code
now this is the error
module.js:471
throw err;
^
Error: Cannot find module 'E:\mindsumo\dataairbnb\models/..configconfig.json'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (E:\mindsumo\dataairbnb\models\index.js:8:17)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (E:\mindsumo\dataairbnb\server.js:10:11)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:390:7)
at startup (bootstrap_node.js:150:9)
at bootstrap_node.js:505:3
Error while making model
node_modules/.bin/sequelize model:generate --name calender1 --attributes
listing_id:int, listdate:date, available:text, price:text
node_modules/.bin/sequelize model:generate --name calender1 --attributes listing_id:int, lis
tdate:date, available:text, price:text
Sequelize CLI [Node: 6.10.3, CLI: 3.0.0, ORM: 3.30.4]
E:\mindsumo\studyairbnb\node_modules\sequelize-cli\node_modules\yargs\yargs.js:1079
else throw err
^
TypeError: Cannot read property 'toUpperCase' of undefined
at eval (lodash.templateSources[0]:18:32)
at Array.forEach (native)
at eval (lodash.templateSources[0]:14:26)
at Object.render (E:\mindsumo\studyairbnb\node_modules\sequelize-
cli\lib\helpers\template-helper.js:26:54)
at Object.generateFileContent
(E:\mindsumo\studyairbnb\node_modules\sequelize-cli\lib\helpers\model-
helper.js:31:37)
at Object.generateFile (E:\mindsumo\studyairbnb\node_modules\sequelize-
cli\lib\helpers\model-helper.js:41:49)
at Object.exports.handler (E:\mindsumo\studyairbnb\node_modules\sequelize-cli\lib\commands\model_generate.js:32:27)
at Object.self.runCommand (E:\mindsumo\studyairbnb\node_modules\sequelize-cli\node_modules\yargs\lib\command.js:233:22)
at Object.Yargs.self._parseArgs (E:\mindsumo\studyairbnb\node_modules\sequelize-cli\node_modules\yargs\yargs.js:990:30)
at Object.get [as argv] (E:\mindsumo\studyairbnb\node_modules\sequelize-cli\node_modules\yargs\yargs.js:927:19)
at Object.<anonymous> (E:\mindsumo\studyairbnb\node_modules\sequelize-cli\lib\sequelize:84:15)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
E:\mindsumo\studyairbnb\node_modules\sequelize-
cli\node_modules\yargs\yargs.js:1079
else throw err
^
If you used Express framework, this example help you a lot:
https://github.com/sequelize/express-example/tree/master/models
I too had problems with Sequelize in the start.
Check especially:
models/index.js
models/user.js
routes/index.js

Can't run gulp because of Error

I just installed gulp in my project directory and it does not run because of this error. I have a secrets.json file in the directory, how can I make gulp work
Wuns-iMac:cayenna wunwun$ gulp
fs.js:641
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
Error: ENOENT: no such file or directory, open './.secrets.json'
at Error (native)
at Object.fs.openSync (fs.js:641:18)
at Object.fs.readFileSync (fs.js:509:33)
at Object.<anonymous> (/Users/wunwun/Documents/websites/cayenna/gulp/tasks/deploy.js:12:31)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at requireDir (/Users/wunwun/Documents/websites/cayenna/node_modules/require-dir/index.js:123:33)
at Object.<anonymous> (/Users/wunwun/Documents/websites/cayenna/gulpfile.js:5:1)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Liftoff.handleArguments (/usr/local/lib/node_modules/gulp/bin/gulp.js:116:3)
at Liftoff.<anonymous> (/usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:198:16)
at module.exports (/usr/local/lib/node_modules/gulp/node_modules/flagged-respawn/index.js:17:3)
at Liftoff.<anonymous> (/usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:190:9)
at /usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:164:9
at /usr/local/lib/node_modules/gulp/node_modules/v8flags/index.js:110:14
at /usr/local/lib/node_modules/gulp/node_modules/v8flags/index.js:38:12
at /usr/local/lib/node_modules/gulp/node_modules/v8flags/index.js:49:7

Cant' install gulp

When I try to install gulp in my project repository, this message show:
Error: Cannot find module 'clone' at Function.Module._resolveFilename
(module.js:325:15) at Function.Module._load (module.js:276:25) at
Module.require (module.js:353:17) at require
(internal/module.js:12:17) at Object.
(C:\laragon\www\hms52\node_modules\laravel-elixir\node
_modules\gulp-util\node_modules\vinyl\index.js:2:13) at Module._compile (module.js:409:26) at Object.Module._extensions..js
(module.js:416:10) at Module.load (module.js:343:32) at
Function.Module._load (module.js:300:12) at Module.require
(module.js:353:17) at require (internal/module.js:12:17)

nodejs mysql (libmysqlclient)

I use https://github.com/calzoneman/sync project and get this error. I'm new to nodejs. How to fix this?
I done all in installation manual
root#srv:/var/www/synch# node server.js
Starting CyTube v1.9.5
/var/www/synch/node_modules/mysql-libmysqlclient/lib/mysql-libmysqlclient.js:208
MysqlConnectionQueued.prototype = new bindings.MysqlConnection();
^
TypeError: Cannot read property 'MysqlConnection' of null
at Object.<anonymous> (/var/www/synch/node_modules/mysql-libmysqlclient/lib/mysql-libmysqlclient.js:208:47)
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)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/var/www/synch/auth.js:12:13)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)