简体   繁体   English

如何解决错误Object# <Object> node.js中没有方法“ Router”

[英]How to resolve error Object #<Object> has no method 'Router' in node.js

In routes/index.js 在routes / index.js中

var express = require('express');
var router = express.Router();

it gives an error 它给出了一个错误

TypeError: Object #<Object> has no method 'Router'
at Object.<anonymous> (/home/des0071/nodetest1/routes/index.js:6:35)

Check your express version 检查您的快递版本

Express router came in express 4 Express路由器进入Express 4

After updating your express version then try to use it 更新快速版本后,请尝试使用它

var express = require('express');
var router = express.Router();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在node.js中删除&#39;Object has no method&#39;forEach&#39;错误? - How to remove 'Object has no method 'forEach' error in node.js'? Node.js对象[object Object]没有方法错误 - Node.js Object [object Object] has no method error 奇怪的 node.js 错误:TypeError: Object #<Object> 没有方法“开” - Strange node.js error: TypeError: Object #<Object> has no method 'on' Node.js错误:对象函数没有方法 - Node.js Error: Object function has no method 升级后的Node.js hapi错误:TypeError:未捕获的错误:Object [对象Object]没有方法&#39;reply&#39; - Node.js hapi error after upgrading: TypeError: Uncaught error: Object [object Object] has no method 'reply' Node.js Object对象没有方法'hasOwnProperty' - Node.js Object object has no method 'hasOwnProperty' 在Node.js服务器内发出异步请求错误:“ TypeError:对象# <Object> 没有方法“ _implicitHeader”” - Making asynchronous requests within a Node.js server error:“TypeError: Object #<Object> has no method '_implicitHeader'” node.js TypeError:对象没有方法get - node.js TypeError: Object has no method get node.js cassandra驱动程序给出错误:对象没有方法“ setMaxListeners” - node.js cassandra-driver gives error: Object has no method 'setMaxListeners' 在node.js中使用参数时,对象没有方法'reduce'错误? - Object has no method 'reduce' error when using arguments in node.js?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM