Hi I'm trying to use jade
and express
together. But it is giving me TypeError
.
I made npm init
, npm install express -save
and then node app.js
. But it is giving me same error "TypeError: express is not a function"
// Module dependencies
var express = require('express')
, nib = require('nib')
, mysql = require('mysql')
var app = express();
var app = module.exports = app.createServer();
app.set('views', __dirname + '/views')
app.set('view engine', 'jade')
app.use(express.logger('dev'))
And package.json
:
{
"name": "reddit-node-mysql",
"description": "A demo of how to use Express and MySQL together",
"author": "Clarence Leung <github@clarle>",
"version": "0.0.1",
"private": true,
"dependencies": {
"express": "^2.5.11",
"mysql": "~2.0",
"nib": "^1.1.2",
"jade": "^1.0.4"
},
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"license": "ISC",
"devDependencies": {}
}
Solution My modules' version outdated so they can't installed well. I updated version of them, now working.
TypeError: "x" is not a function The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value is not actually a function.
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value is not actually a function. What went wrong? It attempted to call a value from a function, but the value is not actually a function. Some code expects you to provide a function, but that didn't happen.
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value is not actually a function. Message TypeError: Object doesn't support property or method {x} (Edge) TypeError: "x" is not a function
Throws 'TypeError: date.formt is not a function' date.formt ('YYYY-MM-DD'); If JavaScript throws this error in code that you wrote, you should double check the code at the line number in the error's stack trace.
You are using outdated express ,
Remove"express": "^2.5.11",
from package json
and run
npm install --save express
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With