Skip to content
This repository has been archived by the owner on May 28, 2021. It is now read-only.

TypeError: validator is not a function #144

Open
Diantha opened this issue Jul 2, 2019 · 2 comments
Open

TypeError: validator is not a function #144

Diantha opened this issue Jul 2, 2019 · 2 comments

Comments

@Diantha
Copy link

Diantha commented Jul 2, 2019

Hi all,
I have correctly set the node modules with npm install, but If I try to use :
npm run dev
I got this:

[email protected] dev C:\Users\Desktop\vue-express-mongo-boilerplate-master\vue-express-mongo-boilerplate-master
cross-env NODE_ENV=development nodemon --inspect

[nodemon] 1.19.1
[nodemon] to restart at any time, enter rs
[nodemon] watching: C:\Users\Desktop\vue-express-mongo-boilerplate-master\vue-express-mongo-boilerplate-master\server/**/* config.js webpack.*.config.js
[nodemon] starting node --inspect server/index.js
Debugger listening on ws://127.0.0.1:9229/547d9438-6837-4cc6-8fa9-829d7a138713
For help, see: https://nodejs.org/en/docs/inspector
process.argv: C:\Users\Desktop\vue-express-mongo-boilerplate-master\vue-express-mongo-boilerplate-master\server\index.js
Application root path: C:\Users\Desktop\vue-express-mongo-boilerplate-master\vue-express-mongo-boilerplate-master
{"message":{},"level":"info"}
{"level":"info","message":"\u001b[1m---------------------[ Server starting at %s ]---------------------------\u001b[22m"}
{"message":{},"level":"info"}
{"message":"\u001b[1mApplication root path: \u001b[22mC:\Users\Desktop\vue-express-mongo-boilerplate-master","level":"info"}
{"message":"Loaded configuration:","level":"info"}
{"message":{"hashSecret":"CShgVx7GFQrHqsMZvm1I6GeXZXxXIQQon9nr3q9FW3z","sessionSecret":"Y0G4x8SdTg6p56ItLdsydQ1iQdqiGGrzAfaWDYxV9DA","app":{"title":"Vue-Express-Mongo BoilerPlate","version":"0.9.0","description":"Express NodeJS application server boilerplate with Mongo and VueJS","keywords":"boilerplate,express,mongo,vue,mongodb,hackaton,bootstrap,starter","url":"http://localhost:3000/","contactEmail":"[email protected]"},"db":{"options":{"user":"","pass":"","useNewUrlParser":true,"keepAlive":1},"uri":"mongodb://localhost/boilerplate-dev"},"redis":{"enabled":false,"uri":"redis://localhost:6379","options":null},"mailer":{"enabled":false,"from":"[email protected]"},"features":{"disableSignUp":false,"verificationRequired":true},"authKeys":{"google":{"clientID":null,"clientSecret":null},"facebook":{"clientID":null,"clientSecret":null},"github":{"clientID":null,"clientSecret":null},"twitter":{"clientID":null,"clientSecret":null}},"logging":{"console":{"level":"debug"},"file":{"enabled":false,"path":"C:\Users\Desktop\vue-express-mongo-boilerplate-master\vue-express-mongo-boilerplate-master\logs","level":"info","json":false,"exceptionFile":true},"graylog":{"enabled":false},"papertrail":{"enabled":false,"host":null,"port":null,"level":"debug","program":"vem"},"logentries":{"enabled":false,"token":null},"loggly":{"enabled":false,"token":null,"subdomain":null},"logsene":{"enabled":false,"token":null},"logzio":{"enabled":false,"token":null}},"ip":"0.0.0.0","port":3000,"rootPath":"C:\Users\Desktop\vue-express-mongo-boilerplate-master\vue-express-mongo-boilerplate-master","dataFolder":"C:\Users\Desktop\vue-express-mongo-boilerplate-master\data","uploadLimit":2097152,"sessions":{"cookie":{"maxAge":604800000,"httpOnly":true,"secure":false},"name":"sessionId","collection":"sessions"},"test":false,"cacheTimeout":300,"agendaTimer":"one minute"},"level":"info"}
{"message":{},"level":"info"}
{"message":{},"level":"info"}
{"message":"Connecting to Mongo mongodb://localhost/boilerplate-dev...","level":"info"}
C:\Users\Desktop\vue-express-mongo-boilerplate-master\server\core\express.js:77
app.use(validator());
^

TypeError: validator is not a function
at initMiddleware (C:\Users\Desktop\vue-express-mongo-boilerplate-master\server\core\express.js:77:10)
at module.exports (C:\Users\Desktop\vue-express-mongo-boilerplate-master\vue-express-mongo-boilerplate-master\server\core\express.js:314:2)
at Object. (C:\Users\Desktop\vue-express-mongo-boilerplate-master\vue-express-mongo-boilerplate-master\server\index.js:18:38)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787: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 Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
[nodemon] app crashed - waiting for file changes before starting...

Why?
Nothing is running on my pc and MongoDb is running on port 27017

@softMaina
Copy link

softMaina commented Jul 11, 2019

Some google search indicates that it is a version issue.
I solved it by downgrading from ^6.0.0 to ^4.3.0
npm i --save express-validator@4

@yangboz
Copy link

yangboz commented Dec 23, 2020

but after npm i --save express-validator@4 npm run dev throws:

ERROR in ./client/scss/frontend.scss (./node_modules/css-loader!./node_modules/postcss-loader/lib!./node_modules/sass-loader/lib/loader.js!./client/scss/frontend.scss)
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
Error: Cannot find module 'node-sass'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants