您现在的位置是:网站首页>软件开发>前端技术栈>vuevue

【解决】控制台报错Uncaught TypeError: Object(...) is not a function at eval (vue-router.esm-bundler.js

风口下的猪2022-06-22vue

简介

打开http://localhost:8080/,控制台报错


Uncaught TypeError: Object(...) is not a function
    at eval (vue-router.esm-bundler.js?f2fc:2127:1)
    at Object../node_modules/vue-router/dist/vue-router.esm-bundler.js (app.js:2218:1)
    at __webpack_require__ (app.js:679:30)
    at fn (app.js:89:20)
    at eval (index.js?3672:1:1)
    at Object../src/router/index.js (app.js:2358:1)
    at __webpack_require__ (app.js:679:30)
    at fn (app.js:89:20)
    at eval (main.js?1c90:1:1)
    at Object../src/main.js (app.js:2350:1)


cmd运行npm run dev没有报错,但也没有显示成功



看了好多篇文章,找了好几天的错,也没有找到解决方法,都不管用,找的心累了,这不终于整好了

【解决办法】: 降低vue-router版本

因为vue-router版本过高,所以报错(我的默认版本是4.0.14的版本)

"dependencies": {
    "element-ui": "^2.15.6",
    "vue": "^2.5.2"
  },
  "devDependencies": {
    "node-sass": "^7.0.1",
    "sass-loader": "^12.6.0",
    "vue-loader": "^13.3.0",
    "vue-router": "^4.0.14",
  } 


1、package.json中修改vue-router版本,然后再npm install下

2、或者在cmd输入

npm install vue-router@3.5.3

再运行npm run dev,成功了







很赞哦! (0)

  • 软件开发
  • 素质要求
  • 计算机基础
  • 架构
  • 安全
  • 性能
  • 运维
  • 尾页
  • 数据库
  • 开发终端
  • 语言基础
  • 项目管理
  • 产品设计
  • 系统
  • 工作规范
  • 计算机网络
  • 前端技术栈
  • 数据结构
  • 计算机组成原理
  • 后端技术栈
  • 性能优化
  • 安全设计
  • 常见模块
  • 计算机操作系统
  • 服务器
  • python
  • MySQL
  • thinkphp
  • PHP
  • Java
  • JavaScript
  • Windows
  • Linux
  • 特效
  • indexedDB
  • vue
  • 淘宝联盟
  • Ionic
  • Angular
  • 微信小程序
  • 支付宝小程序
  • uni-app
  • css/sass/less
  • 支付
  • socket
  • 爬虫
  • web性能优化
  • 消息推送
  • CVM
  • sqlite
  • Redis
  • 前端基础
  • 基础
  • element
  • Nginx
  • yii2
  • /ponder/index.php/index/catelist/catelist/cateid/10.html

    相关阅读 (同一栏目)

    << /

    标签云

    站点信息

    • 文章统计:528篇
    • 移动端访问:扫码进入SQ3R